您可能正在寻找
numpy.insert
>>> import numpy as np>>> a = np.zeros((2, 2))>>> aarray([[ 0., 0.], [ 0., 0.]])# In the following line 1 is the index before which to insert, 0 is the axis.>>> np.insert(a, 1, np.array((1, 1)), 0) array([[ 0., 0.], [ 1., 1.], [ 0., 0.]])>>> np.insert(a, 1, np.array((1, 1)), 1)array([[ 0., 1., 0.], [ 0., 1., 0.]])
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)