This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / nanargmax

_ArrayFunctionDispatcher

numpy:nanargmax

source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_nanfunctions_impl.py :571

Signature

def   nanargmax ( a axis = None out = None * keepdims = <no value> )

Summary

Return 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

a : array_like

Input data.

axis : int, optional

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

out : array, optional

If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype.

keepdims : bool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.

Returns

index_array : ndarray

An array of indices or a single index value.

Examples

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

See also

argmax
nanargmin

Aliases

  • numpy.nanargmax

Referenced by

This package