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

Nathaniel Smith njs@pobox....
Fri Jan 11 16:00:55 CST 2013


On Thu, Jan 10, 2013 at 9:40 AM, Chao YUE <chaoyuejoy@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