http://docs.scipy.org/doc/numpy/reference/generated/numpy.percentile.html
numpy.percentile(a, q, axis=None, out=None, overwrite_input=False, interpolation=‘linear‘, keepdims=False)[source]¶
Compute the qth percentile of the data along the specified axis.
Returns the qth percentile of the array elements.
>>> a = np.array([[10, 7, 4], [3, 2, 1]])
>>> a
array([[10, 7, 4],
[ 3, 2, 1]])
>>> np.percentile(a, 50)
array([ 3.5])
>>> np.percentile(a, 50, axis=0)
array([[ 6.5, 4.5, 2.5]])
>>> np.percentile(a, 50, axis=1)
array([[ 7.],
[ 2.]])
时间: 2024-10-23 20:02:49