[Numpy-discussion] Array slices and number of dimensions

Pauli Virtanen pav@iki...
Wed Sep 1 17:05:07 CDT 2010


Wed, 01 Sep 2010 17:54:26 -0400, Thomas Robitaille wrote:
> >>> a[[0],:,:].shape
> (1, 10, 10)
[clip]
> so I can get around the issue, but just wanted to check whether the
> issue with a[[0],:,[5]] is a bug?

No. The syntax does not mean what you think it means, see

http://docs.scipy.org/doc/numpy/user/basics.indexing.html#indexing-multi-dimensional-arrays

http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#advanced-indexing

-- 
Pauli Virtanen



More information about the NumPy-Discussion mailing list