[Numpy-discussion] Slicing/selection in multiple dimensions simultaneously
David Warde-Farley
dwf@cs.toronto....
Mon Mar 2 13:10:36 CST 2009
On 2-Mar-09, at 12:25 PM, Robert Kern wrote:
> a[[2,3,6], ...][..., [3,2]]
>
> You're doing fancy indexing, so there are copies both times.
D'oh!
So I guess the only way to avoid the second copy is to do what Jon
initially suggested, i.e. a[ix_([2,3,6],range(a.shape[1]),[3,2])] ?
I suppose xrange would be better than arange() or range() as it
wouldn't create and destroy the list all at once.
D
More information about the Numpy-discussion
mailing list