返回沿某轴axis方向上的最大值 - 最小区 差值
import numpy as np a = np.array([[3,7,5],[8,4,3],[2,4,9]]) print(a) print(np.ptp(a)) print(np.ptp(a,axis=1)) print(np.ptp(a,axis=0))
[[3 7 5]
[8 4 3]
[2 4 9]]
7
[4 5 7]
[6 3 6]
返回沿某轴axis方向上的最大值 - 最小区 差值
import numpy as np a = np.array([[3,7,5],[8,4,3],[2,4,9]]) print(a) print(np.ptp(a)) print(np.ptp(a,axis=1)) print(np.ptp(a,axis=0))
[[3 7 5]
[8 4 3]
[2 4 9]]
7
[4 5 7]
[6 3 6]