dpnp.nanargmax
- dpnp.nanargmax(a, axis=None, out=None, *, keepdims=False)[source]
Returns the indices of the maximum values along an axis ignoring NaNs.
For full documentation refer to
numpy.nanargmax
.- Parameters:
a ({dpnp.ndarray, usm_ndarray}) -- Input array.
axis ({None, int}, optional) -- Axis along which to operate. By default flattened input is used. Default:
None
.out ({None, dpnp.ndarray, usm_ndarray}, optional) -- If provided, the result will be inserted into this array. It should be of the appropriate shape and dtype. Default:
None
.keepdims ({None, 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. Default:False
.
- Returns:
out -- If axis is
None
, a zero-dimensional array containing the index of the first occurrence of the maximum value ignoring NaNs; otherwise, a non-zero-dimensional array containing the indices of the minimum values ignoring NaNs. The returned array must have the default array index data type. For all-NaN slicesValueError
is raised. Warning: the results cannot be trusted if a slice contains only NaNs and -Infs.- Return type:
dpnp.ndarray
Limitations
Input array is only supported as either
dpnp.ndarray
ordpctl.tensor.usm_ndarray
. Input array data types are limited by supported DPNP Available array data types.See also
dpnp.nanargmin
Returns the indices of the minimum values along an axis, ignoring NaNs.
dpnp.argmax
Returns the indices of the maximum values along an axis.
Examples
>>> import dpnp as np >>> a = np.array([[np.nan, 4], [2, 3]]) >>> np.argmax(a) array(0) >>> np.nanargmax(a) array(1) >>> np.nanargmax(a, axis=0) array([1, 0]) >>> np.nanargmax(a, axis=1) array([1, 1])