numpy.percentile

Posted 挣脱生命的束缚...

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了numpy.percentile相关的知识,希望对你有一定的参考价值。

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.]])

 

以上是关于numpy.percentile的主要内容,如果未能解决你的问题,请参考以下文章