我正在尝试将2个数组((4x1)和(3x1))互相堆叠,像这样:
q = [1,
2,
3,
4]
o = [5,
6,
7]
qo = [1
2
3
4
5
6
7]
但是,当我尝试通过以下方式进行操作时:q0 = np.stack((q, o))
我收到错误消息:ValueError: all input arrays must have the same shape
。
老实说,我什至不知道如何解决这个问题。任何帮助表示赞赏。
编辑:
Output of print(q) is
1
2
3
4
Output of print(o) is:
5
6
7
答案 0 :(得分:0)
发帖以防其他人需要答案。
qo = np.concatenate((q, o))
这对我有用。