dpnp.nanmin

dpnp.nanmin(a, axis=None, out=None, keepdims=False, initial=None, where=True)[source]

Return the minimum of an array or minimum along an axis, ignoring any NaNs.

For full documentation refer to numpy.nanmin.

Parameters:
  • a ({dpnp.ndarray, usm_ndarray}) -- Input array.

  • axis ({None, int, tuple of ints}, optional) -- Axis or axes along which minimum values must be computed. By default, the minimum value must be computed over the entire array. If a tuple of integers, minimum values must be computed over multiple axes. 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 ({None, bool}, optional) -- 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, if False, the reduced axes (dimensions) must not be included in the result. Default: False.

Returns:

out -- If the minimum value was computed over the entire array, a zero-dimensional array containing the minimum value ignoring NaNs; otherwise, a non-zero-dimensional array containing the minimum values ignoring NaNs. The returned array must have the same data type as a. When all-NaN slices are encountered a RuntimeWarning is raised and NaN is returned for that slice.

Return type:

dpnp.ndarray

Limitations

Input array is only supported as either dpnp.ndarray or dpctl.tensor.usm_ndarray. Parameters where, and initial are only supported with their default values. Otherwise NotImplementedError exception will be raised. Input array data types are limited by supported DPNP Available array data types.

See also

dpnp.nanmax

The maximum value of an array along a given axis, ignoring any NaNs.

dpnp.min

The minimum value of an array along a given axis, propagating any NaNs.

dpnp.fmin

Element-wise minimum of two arrays, ignoring any NaNs.

dpnp.minimum

Element-wise minimum of two arrays, propagating any NaNs.

dpnp.isnan

Shows which elements are Not a Number (NaN).

dpnp.isfinite

Shows which elements are neither NaN nor infinity.

Examples

>>> import dpnp as np
>>> a = np.array([[1, 2], [3, np.nan]])
>>> np.nanmin(a)
array(1.)
>>> np.nanmin(a, axis=0)
array([1.,  2.])
>>> np.nanmin(a, axis=1)
array([1.,  3.])

When positive infinity and negative infinity are present:

>>> np.nanmin(np.array([1, 2, np.nan, np.inf]))
array(1.)
>>> np.nanmin(np.array([1, 2, np.nan, np.NINF]))
array(-inf)