[Numpy-discussion] return index of maximum value in an array easily?

Nathaniel Smith njs at pobox.com
Fri Jan 11 17:00:55 EST 2013


On Thu, Jan 10, 2013 at 9:40 AM, Chao YUE <chaoyuejoy at gmail.com> wrote:
> Dear all,
>
> Are we going to consider returning the index of maximum value in an array
> easily
> without calling np.argmax and np.unravel_index consecutively?

This does seem like a good thing to support somehow. What would a good
interface look like? Something like np.nonzero(a == np.max(a))? Should
we support vectorized operation (e.g. argmax of each 2-d subarray of a
3-d array along some axis)?

-n



More information about the NumPy-Discussion mailing list