python numpy np.percentile


"""
np.percentile     、    
        a,      。
np.percentile(a,50)
     50%    ,     0%、100%    ,0%           ,100%            。
1/(len(a)-1)*100       2   ,2/(len(a)-1)*100       3   ,    。
np.percentile()            ,             。
percentile     :
numpy.percentile(a, q, axis=None, out=None, overwrite_input=False)
        a     ,       
        q 0~100            ,            
        axis: a           
"""
import numpy as np

a = np.array([1, 2, 3, 4, 5, 6, 7])
print("np.percentile(a, 50):", np.percentile(a, 50))
print("np.percentile(a, 5):", np.percentile(a, 5))

b = np.array([[1, 2, 3, 4, 5, 6, 7],
              [8, 9, 10, 11, 12, 13, 14]])
b = np.array([[10, 7, 4],
              [3, 2, 1]])
print("np.percentile(b, [0,100]):", np.percentile(b, [0,100]))