【发布时间】:2017-10-24 09:32:48
【问题描述】:
我想把这个多维数组写成软代码
adjust = np.array([[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.],
[0.,1.,0.]])
我为x = [0.,1.,0.] 尝试了np.repeat(x, 10, axis=0),它在同一个括号[] 中重复了它们。可以在这里使用 np.repeat 吗?还是其他 numpy?
还有,可以写软代码吗
adjust = np.array([[0.,0.,1.,0.,0.],
[0.,0.,1.,0.,0.],
[0.,0.,1.,0.,0.]])
将来我可能需要将左右 0 扩展为各种数字?
【问题讨论】:
标签: python numpy multidimensional-array