我遇到了问题np.append.
我正在尝试n_list_converted使用以下代码复制20x361矩阵的最后一列:
n_last = []
n_last = n_list_converted[:, -1]
n_lists = np.append(n_list_converted, n_last, axis=1)
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
ValueError:所有输入数组必须具有相同的维数
但是,我通过这样做检查了矩阵尺寸
print(n_last.shape, type(n_last), n_list_converted.shape, type(n_list_converted))
Run Code Online (Sandbox Code Playgroud)
我明白了
(20L,)(20L,361L)
尺寸是否匹配?哪里出错了?