taking subarray of numpy array code example
Example: taking subarray of numpy array
>>> a
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
>>> a[:2,:2]
array([[1, 2],
[4, 5]])
>>> a
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
>>> a[:2,:2]
array([[1, 2],
[4, 5]])