[Numpy-discussion] Is this an indexing bug?

Sturla Molden sturla@molden...
Tue Jun 19 07:05:35 CDT 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