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

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Nov 17 11:40:05 EST 2009


On Tue, Nov 17, 2009 at 11:24 AM, Jean-Baptiste Rudant
<boogaloojb at 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 at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>



More information about the NumPy-Discussion mailing list