numpy.amin(a,axis=None,out=None,keepdims=<class numpy._globals._NoValue>)[source]¶Return the minimum of an array or minimum along an axis.
| Parameters: | a : array_like
axis : None or int or tuple of ints, optional
out : ndarray, optional
keepdims : bool, optional
|
|---|---|
| Returns: | amin : ndarray or scalar
|
See also
amaxnanminminimumfminargminNotes
NaN values are propagated, that is if at least one item is NaN, thecorresponding min value will be NaN as well. To ignore NaN values(MATLAB behavior), please use nanmin.
Don’t useamin for element-wise comparison of 2 arrays; whena.shape[0] is 2,minimum(a[0],a[1]) is faster thanamin(a,axis=0).
Examples
>>>a=np.arange(4).reshape((2,2))>>>aarray([[0, 1], [2, 3]])>>>np.amin(a)# Minimum of the flattened array0>>>np.amin(a,axis=0)# Minima along the first axisarray([0, 1])>>>np.amin(a,axis=1)# Minima along the second axisarray([0, 2])
>>>b=np.arange(5,dtype=np.float)>>>b[2]=np.NaN>>>np.amin(b)nan>>>np.nanmin(b)0.0