Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.amin

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

Input data.

axis : None or int or tuple of ints, optional

Axis or axes along which to operate. By default, flattened input isused.

New in version 1.7.0.

If this is a tuple of ints, the minimum is selected over multiple axes,instead of a single axis or all the axes as before.

out : ndarray, optional

Alternative output array in which to place the result. Mustbe of the same shape and buffer length as the expected output.Seedoc.ufuncs (Section “Output arguments”) for more details.

keepdims : bool, optional

If this is set to True, the axes which are reduced are leftin the result as dimensions with size one. With this option,the result will broadcast correctly against the input array.

If the default value is passed, thenkeepdims will not bepassed through to theamin method of sub-classes ofndarray, however any non-default value will be. If thesub-classessum method does not implementkeepdims anyexceptions will be raised.

Returns:

amin : ndarray or scalar

Minimum ofa. Ifaxis is None, the result is a scalar value.Ifaxis is given, the result is an array of dimensiona.ndim-1.

See also

amax
The maximum value of an array along a given axis, propagating any NaNs.
nanmin
The minimum value of an array along a given axis, ignoring any NaNs.
minimum
Element-wise minimum of two arrays, propagating any NaNs.
fmin
Element-wise minimum of two arrays, ignoring any NaNs.
argmin
Return the indices of the minimum values.

nanmax,maximum,fmax

Notes

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

Previous topic

Statistics

Next topic

numpy.amax

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp