[Numpy-discussion] Is this an indexing bug?

Sturla Molden sturla at molden.no
Tue Jun 19 08:05:35 EDT 2007


On 6/19/2007 1:28 PM, Stefan van der Walt wrote:
> 
> x = N.arange(100).reshape((10,10))
> x[:,N.arange(5)].shape
> 
> should be (5, 10), while in reality it is (10, 5).


 >>> y = numpy.arange(100).reshape((10,10))
 >>> y[:,numpy.arange(5)].shape
(10,5)

 >>> x = numpy.arange(100).reshape((1,10,10))
 >>> x[0,:,numpy.arange(5)].shape
(5,10)


hm...




Sturla Molden





More information about the NumPy-Discussion mailing list