[Numpy-discussion] 2D array indexing

Gökhan Sever gokhansever at gmail.com
Fri Feb 28 18:32:27 EST 2014


Hello,

Given this simple 2D array:

In [1]: np.arange(9).reshape((3,3))
Out[1]:
array([[0, 1, 2],
       [3, 4, 5],
       [6, 7, 8]])

In [2]: a = np.arange(9).reshape((3,3))

In [3]: a[:1:]
Out[3]: array([[0, 1, 2]])

In [4]: a[:1,:]
Out[4]: array([[0, 1, 2]])

Could you tell me why the last two indexing (note the comma!) results in
the same array? Thanks.

-- 
Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140228/0be8d014/attachment.html>


More information about the NumPy-Discussion mailing list