1.数组均分
numpy.array_split()
2.数组叠加合并
列合并/扩展:np.column_stack()
行合并/扩展:np.row_stack()
>>> a
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
>>> top = np.column_stack((a, np.zeros((3,3))))
>>> top
array([[ 0., 1., 2., 0., 0., 0.],
[ 3., 4., 5., 0., 0., 0.],
[ 6., 7., 8., 0., 0., 0.]])
np.delete()
numpy. delete ( arr, obj, axis=None ) [source]Return a new array with sub-arrays along an axis deleted. For a one dimensional array, this returns those entries not returned by arr[obj].
Parameters: | arr : array_like
obj : slice, int or array of ints
axis : int, optional
|
---|---|
Returns: | out : ndarray
|
3.数据遍历
np.delete()
a = np.arange(9).reshape(3,3)
it = np.nditer(a,flags=['multi_index'], op_flags=['readwrite'])
while not it.finished:
print it.multi_index
it.iternext()
(0,0)
(0,1)
...
(2,2)
https://docs.scipy.org/doc/numpy/reference/generated/numpy.nditer.html