nlcpy.nanmin

nlcpy.nanmin(a, axis=None, out=None, keepdims=<no value>)[source]

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

When all-NaN slices are encountered a RuntimeWarning is raised and Nan is returned for that slice.

Parameters
aarray_like

Array containing numbers whose minimum is desired. If a is not an array, a conversion is attempted.

axisNone or int or tuple of ints, optional

Axis or axes along which to operate. By default, flattened input is used. If this is a tuple of ints, the minimum is selected over multiple axes.

outndarray, optional

Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.

keepdimsbool, 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 input array.

Returns
nanminndarray

Minimum of a. An array with the same shape as a, with the specified axis removed. If a is a scalar, or if axis is None, this function returns the result as a 0-dimention array. The same dtype as a is returned.

See also

nanmax

Returns the maximum of an array or maximum along an axis, ignoring any NaNs.

amin

Returns the minimum of an array or maximum along an axis.

fmin

Element-wise minimum of array elements.

minimum

Element-wise minimum of array elements.

isnan

Tests element-wise for NaN and return result as a boolean array.

isfinite

Tests element-wise for finiteness (not infinity or not Not a Number).

amax

Returns the maximum of an array or maximum along an axis.

fmax

Element-wise maximum of array elements.

maximum

Element-wise maximum of array elements.

Note

NLCPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity. Positive infinity is treated as a very large number and negative infinity is treated as a very small (i.e. negative) number.

If the input has a integer type the function is equivalent to amin().

Examples

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

When positive infinity and negative infinity are present:

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