[Numpy-discussion] indexing question

Charles R Harris charlesr.harris at gmail.com
Tue Mar 30 10:46:22 EDT 2010


On Tue, Mar 30, 2010 at 8:13 AM, Tom K. <tpk at kraussfamily.org> wrote:

>
> This one bit me again, and I am trying to understand it better so I can
> anticipate when it will happen.
>
> What I want to do is get rid of singleton dimensions, and index into the
> last dimension with an array.
>
> In [1]: import numpy as np
>
> In [2]: x=np.zeros((10,1,1,1,14,1024))
>
> In [3]: x[:,0,0,0,:,[1,2,3]].shape
> Out[3]: (3, 10, 14)
>
>
Hmm... That doesn't look right.

<snip>

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100330/5d3a4a5e/attachment.html>


More information about the NumPy-Discussion mailing list