[Numpy-discussion] indexing question

Ernest Adrogué eadrogue@gmx....
Mon Nov 22 14:09:51 CST 2010

22/11/10 @ 11:20 (-0800), thus spake John Salvatier:
> I didn't realize the x's and y's were varying the first time around.
> There's probably a way to omit it, but I think the conceptually
> simplest way is probably what you had to begin with. Build an index by
> saying i = numpy.arange(0, t.shape[0])
> then you can do t[i, x,y]

Exactly. I was just wondering if I can speed this up by omitting
building the "arange array". This is inside a function that gets
called a lot, so I suppose it would make a difference if I can get
rid of it.


More information about the NumPy-Discussion mailing list