[Numpy-discussion] Strange inversion in shape with some slices

josef.pktd@gmai... josef.pktd@gmai...
Tue Nov 17 10:40:05 CST 2009


On Tue, Nov 17, 2009 at 11:24 AM, Jean-Baptiste Rudant
<boogaloojb@yahoo.fr> wrote:
> Hello,
> I think there's something strange with shape when a slice is given by an
> array.
> import numpy as N
> my_array = N.ones((2, 3, 6))
> ind = N.arange(4)
> #you hope to find (3, 4)
> print my_array[0, :, ind].shape
> print my_array[0, :, 0:4].shape
> print my_array[0][:, ind].shape
> print my_array[0][:, 0:4].shape
> """
> (4, 3)
> (3, 4)
> (3, 4)
> (3, 4)
> """
> Jean-Baptiste Rudant

there was a long thread on this with the explanation in March, title
"is it a bug?"

Josef


>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


More information about the NumPy-Discussion mailing list