nums.numpy.argmax
-
nums.numpy.
argmax
(a, axis=None, out=None)[source] Returns the indices of the maximum values along an axis.
This docstring was copied from numpy.argmax.
Some inconsistencies with the NumS version may exist.
- Parameters
a (BlockArray) – Input array.
axis (int, optional) – By default, the index is into the flattened array, otherwise along the specified axis.
out (array, optional) – If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.
- Returns
index_array – Array of indices into the array. It has the same shape as a.shape with the dimension along axis removed.
- Return type
BlockArray of ints
Notes
In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned.
argmax currently only supports one-dimensional arrays.
‘out’ is currently not supported.
Examples
The doctests shown below are copied from NumPy. They won’t show the correct result until you operate
get()
.Indexes of the maximal elements of a N-dimensional array:
>>> b = nps.arange(6) >>> b[1] = 5 >>> b.get() array([0, 5, 2, 3, 4, 5]) >>> nps.argmax(b).get() # Only the first occurrence is returned. array(1)