np.split
Split an array into multiple sub-arrays
向以上函数传递一个索引列表作为参数,索引列表记录的是分裂点位置:
1 | x = [1, 2, 3, 99, 99, 3, 2, 1] |
https://docs.scipy.org/doc/numpy/reference/generated/numpy.split.html
参数:
- ary
- indices or sections
- axis
1 | 9.0) x = np.arange( |
1 | 8.0) x = np.arange( |
np.vsplit和np.hsplit
N 分裂点会得到 N + 1 个子数组。
1 | grid = np.arange(16).reshape((4, 4)) |
https://docs.scipy.org/doc/numpy/reference/generated/numpy.vsplit.html
https://docs.scipy.org/doc/numpy/reference/generated/numpy.hsplit.html
np.dsplit
https://docs.scipy.org/doc/numpy/reference/generated/numpy.split.html
1 | 9.0) x = np.arange( |
1 | 8.0) x = np.arange( |