我有两个数组,如下所示:ss3 = [[0 1 2 3 4 5] [0 1 2 3 4 5] [0 1 2 3 4 5]]ss1 = [[0] [0] [0] [0] [0] [0] [0] [0] [0]]我如何加入它们,以便输出如下所示:s = [[0 1 2 3 4 5][0 1 2 3 4 5][0 1 2 3 4 5][0][0][0][0][0][0][0][0][0]]我试过:s = np.concatenate(ss3,ss1,axis=0)但不断收到错误:ValueError: all the input array dimensions except for the concatenation axis must match exactly
1 回答
慕森卡
TA贡献1806条经验 获得超8个赞
如果它们只是数组,则可以使用:
ss3 = [[0, 1, 2, 3, 4, 5],[0, 1, 2, 3, 4, 5],[0, 1, 2, 3, 4, 5]]
ss1 = [[0],[0],[0],[0],[0],[0],[0],[0],[0]]
merged = ss3+ss1
这使:
[[0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0], [0], [0], [0], [0], [0], [0], [0], [0]]
添加回答
举报
0/150
提交
取消