[Numpy-discussion] Getting an item in an array with its coordinates given by another array

Matthieu Brucher matthieu.brucher@gmail....
Sun Oct 28 09:55:01 CDT 2007


I'm trying to get an item in an array when I only have another array giving
the position.

For instance:

>>> c = numpy.arange(0., 3*4*5).reshape((3,4,5))
>>> c***(numpy.array((2,3), dtype=int))
[55, 56, 57, 58, 59]

I'm trying to figure what to put between c and ((2,3)). I supposed that the
take method would be what I wanted but it is not... The [] operator does not
work on array(but it seems to give the expected result with a tuple or a
list). Is there a method for this ?


French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20071028/f9a4fea1/attachment.html 

More information about the Numpy-discussion mailing list