简体   繁体   English

将 ndarray 数据移动到另一个

[英]Move ndarray data into another one

I want to move the np.array with 3 rows and 2 columns into a.我想将 3 行 2 列的 np.array 移动到一个。

import numpy as np
a = np.zeros((3,2))
a[:,1] = np.array([[3],[3],[3]])

but some errors there.但那里有一些错误。

Exception has occurred: ValueError
 could not broadcast input array from shape (3,1) into shape (3,)

Would you tell me how to move it?你能告诉我怎么移动它吗?

import numpy as np
a = np.zeros((3,2))
a[:,1] = np.array([3,3,3])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM