nanmin

array_api_extra.nanmin(a, /, *, axis=None, xp=None)

Return the minimum of the array elements along a given axis, ignoring NaNs.

Parameters:
  • a (object) – Input array.

  • axis (int | tuple[int, ...] | None) – Axis or axes along which the minimum is computed. The default is to compute the minimum of the flattened array.

  • xp (ModuleType | None) – The standard-compatible namespace for a. Default: infer.

Returns:

An array of minimum values along the given axis, ignoring NaNs.

Return type:

object

Examples

>>> import array_api_extra as xpx
>>> import array_api_strict as xp
>>> a = xp.asarray([[5, 3, xp.nan, 1], [4, xp.nan, 2, xp.nan]])
>>> xpx.nanmin(a)
Array(1., dtype=array_api_strict.float64)
>>> xpx.nanmin(a, axis=0)
Array([4., 3., 2., 1.], dtype=array_api_strict.float64)
>>> xpx.nanmin(a, axis=1)
Array([1., 2.], dtype=array_api_strict.float64)