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

 

posted on 2016-03-31 21:56  qqhfeng16  阅读(2447)  评论(0编辑  收藏  举报