argmax and argmin
argminxf(x) is the value of x for which f(x) attains it’s minimum.
argmaxxf(x) is the value of x for which f(x) attains it’s maximum.
In Python
ARGMIN AND ARGMAX returns Indices of the minimum and maximum values along an axis.
Syntax
numpy.argmax(a, axis=None)
a (array_like) | Input array. |
axis (int, optional) | By default, the index is into the flattened array, otherwise along the specified axis. |
Returning Value
index_array (ndarray of ints) | Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed. |
Example
>>> from numpy import * >>> a = [[1,2,4],[6,3,8],[9,6,1]] >>> argmax(a) 6 >>> argmin(a) 0