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 (int, optional) – Axis along which to search. If
None, the function must return the index of the maximum value of the flattened array. 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.
keepdims (bool) – If
True, the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array. Otherwise, ifFalse, the reduced axes (dimensions) must not be included in the result. 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 slicesValueErroris 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.ndarrayordpctl.tensor.usm_ndarray. Input array data types are limited by supported DPNP Data types.See also
dpnp.nanargminReturns the indices of the minimum values along an axis, igonring NaNs.
dpnp.argmaxReturns 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])