argmax

mipylib.numeric.minum.argmax(a, axis=None)

Returns the indices of the maximum values along an axis.

Parameters:
  • a – (array_like) Input array.

  • axis – (int) By default, the index is into the flattened array, otherwise along the specified axis.

Returns:

Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.

Examples:

>>> a = arange(6).reshape(2,3)
>>> a
array([[0, 1, 2]
      [3, 4, 5]])
>>> argmax(a)
5
>>> argmax(a, axis=0)
array([1, 1, 1])
>>> argmax(a, axis=1)
array([2, 2])