ak.argmax — Awkward Array 2.8.2 documentation (original) (raw)

Defined in awkward.operations.ak_argmax on line 24.

ak.argmax(array, axis=None, *, keepdims=False, mask_identity=True, highlevel=True, behavior=None, attrs=None)#

Parameters:

Returns the index position of the maximum value in each group of elements from array (many types supported, including all Awkward Arrays and Records). The identity of maximization would be negative infinity, but argmax must return the position of the maximum element, which has no value for empty lists. Therefore, the identity should be masked: the argmax of an empty list is None. If mask_identity=False, the result would be -1, which is distinct from all valid index positions, but care should be taken that it is not misinterpreted as “the last element of the list.”

This operation is the same as NumPy’sargmaxif all lists at a given dimension have the same length and no None values, but it generalizes to cases where they do not.

See ak.sum for a more complete description of nested list and missing value (None) handling in reducers.

See also ak.nanargmax.