numpy.percentile()的计算

numpy.percentile() in python:
https://www.geeksforgeeks.org/numpy-percentile-in-python/

数组排序后,按比列取数组的大小数据

import numpy as np
 
# 2D array
arr = [[14, 17, 12, 33, 44], 
       [15, 6, 27, 8, 19],
       [23, 2, 54, 1, 4,]]
print("\narr : \n", arr)
    
# Percentile of the flattened array
print("\n50th Percentile of arr, axis = None : ",
      np.percentile(arr, 50))
print("0th Percentile of arr, axis = None : ",
      np.percentile(arr, 0))
    
# Percentile along the axis = 0
print("\n50th Percentile of arr, axis = 0 : ",
      np.percentile(arr, 50, axis =0))
print("0th Percentile of arr, axis = 0 : ",
      np.percentile(arr, 0, axis =0))
arr : 
 [[14, 17, 12, 33, 44], [15, 6, 27, 8, 19], [23, 2, 54, 1, 4]]

50th Percentile of arr, axis = None :  15.0
0th Percentile of arr, axis = None :  1.0

50th Percentile of arr, axis = 0 :  [15.  6. 27.  8. 19.]
0th Percentile of arr, axis = 0 :  [14.  2. 12.  1.  4.]

50th Percentile of arr, axis = 1 :  [17. 15.  4.]
0th Percentile of arr, axis = 1 :  [12.  6.  1.]

你可能感兴趣的:(笔记,术语,numpy,python,开发语言)