nlcpy.nanargmax

nlcpy.nanargmax(a, axis=None)[source]

Returns the indices of the maximum values in the specified axis ignoring NaNs.

For all-NaN slices ValueError is raised. Warning: the results cannot be trusted if a slice contains only NaNs and -Infs.

Parameters
aarray_like

Input data.

axisint, optional

Axis along which to operate. By default flattened input is used.

Returns
index_arrayndarray

An array of indices or a single index value.

See also

argmax

Returns the indices of the maximum values along an axis.

nanargmin

Returns the indices of the minimum values in the specified axis ignoring NaNs.

Examples

>>> import nlcpy as vp
>>> a = vp.array([[vp.nan, 4], [2, 3]])
>>> vp.argmax(a)
array(0)
>>> vp.nanargmax(a)
array(1)
>>> vp.nanargmax(a, axis=0)
array([1, 0])
>>> vp.nanargmax(a, axis=1)
array([1, 1])