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

Jean-Baptiste Rudant boogaloojb@yahoo...
Tue Nov 17 10:24:52 CST 2009


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



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20091117/549a2f7e/attachment.html 


More information about the NumPy-Discussion mailing list