[英]Concatenate two arrays Python
我有大小为A (1, 1, 59)
和B (1, 95, 59)
(1, 1, 59)
数组。 我想连接数组。 数组的大小应为(1, 96, 59)
。
np.concatenate((A, B),axis =0)
不行。 错误是ValueError: all the input array dimensions except for the concatenation axis must match exactly
轴不正确:
>>> import numpy as np
>>> A = np.ones((1,1,59))
>>> B = np.zeros((1,56,59))
>>> np.concatenate((A, B), axis=1)
array([[[ 1., 1., 1., ..., 1., 1., 1.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
...,
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.]]])
>>> _.shape
(1, 57, 59)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.