array函数
np.split(array, indices_or_sections, axis=0)
函数原型:np.split(array, indices_or_sections, axis=0)->[np.ndarray]
参数说明:
其中indeces_or_sections 可以是整数或者list。
- 整数代表用这个数平均切分
-
np.diff(array, n=1,axis=-1)
函数原型
np.diff(array,n=1,axis=-1)->np.ndarray,作用是计算矩阵的离散插值(后一个值减前一个值)。
参数说明: n:计算几次离散插值
用例:
import numpy as npA = np.arange(2 , 14).reshape((3 , 4))A[1 , 1] = 8print('A:' , A)# A: [[ 2 3 4 5]# [ 6 8 8 9]# [10 11 12 13]]print(np.diff(A))# [[1 1 1]# [2 0 1]# [1 1 1]]
