nanmin#

ivy.nanmin(x, /, *, axis=None, keepdims=False, out=None, initial=None, where=None)[source]#

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

Parameters:
  • a – Input array.

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

  • out (Optional[Array], default: None) – optional output array, for writing the result to.

  • keepdims (Optional[bool], default: False) – 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 original a.

  • initial (Optional[Union[int, float, complex]], default: None) – The maximum value of an output element.

  • where (Optional[Array], default: None) – Elements to compare for the minimum

Return type:

Array

Returns:

ret – Return minimum of an array or minimum along an axis, ignoring any NaNs

Functional Examples

>>> a = ivy.array([[1, ivy.nan], [3, 4]])
>>> ivy.nanmin(a)
1.0
>>> ivy.nanmin(a, axis=1)
[1. 3.]
>>> ivy.nanmin(a, axis=0, keepdims=True)
[[1. 2.]]
Array.nanmin(self, /, *, axis=None, keepdims=False, initial=None, where=None, out=None)[source]#

ivy.Array instance method variant of ivy.nanmin. This method simply wraps the function, and so the docstring for ivy.min also applies to this method with minimal changes.

Parameters:
  • self (Array) – Input array.

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

  • out (Optional[Array], default: None) – optional output array, for writing the result to.

  • keepdims (Optional[bool], default: False) – 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 original a.

  • initial (Optional[Union[int, float, complex]], default: None) – The maximum value of an output element

  • where (Optional[Array], default: None) – Elements to compare for the minimum

Return type:

Array

Returns:

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

Examples

>>> a = ivy.array([[1, 2], [3, ivy.nan]])
>>> a.nanmin(a)
1.0
>>> a.nanmin(a, axis=0)
ivy.array([1., 2.])
Container.nanmin(self, /, *, axis=None, keepdims=False, out=None, initial=None, where=None)[source]#

ivy.Container instance method variant of ivy.nanmin. This method simply wraps the function, and so the docstring for ivy.nanmin also applies to this method with minimal changes.

Parameters:
  • self (Container) – Input container including arrays.

  • axis (Optional[Union[int, Tuple[int], Container]], default: None) – Axis or axes along which the minimum is computed. The default is to compute the minimum of the flattened array.

  • out (Optional[Container], default: None) – optional output array, for writing the result to.

  • keepdims (Optional[Union[bool, Container]], default: False) – 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 original a.

  • initial (Optional[Union[int, float, complex, Container]], default: None) – The maximum value of an output element.

  • where (Optional[Union[Array, Container]], default: None) – Elements to compare for the minimum.

Return type:

Container

Returns:

ret – Return minimum of an array or minimum along an axis, ignoring any NaNs

Examples

>>> a = ivy.Container(x=ivy.array([[1, 2], [3, ivy.nan]]),                                y=ivy.array([[ivy.nan, 1, 2], [1, 2, 3]])
>>> a.nanmin()
{
    x: 12.0
    y: 12.0
}