返回我有一个循环其生成numpy的数组:合并numpy的阵列从环
for x in range(0, 1000):
myArray = myFunction(x)
返回的数组是总是一维的。我想所有的数组一维组合成一个阵列(也。
我尝试以下,但它未能
allArrays = []
for x in range(0, 1000):
myArray = myFunction(x)
allArrays += myArray
的错误是ValueError: operands could not be broadcast together with shapes (0) (9095)
,我怎么能得到那个工作?
例如这两个数组:
[ 234 342 234 5454 34 6]
[ 23 2 1 4 55 34]
应合并成该数组:
[ 234 342 234 5454 34 6 23 2 1 4 55 34 ]
你要总结它们,或者将它们连接起来? – wim
我想连接它们。 – ustroetz
也许串接((a,b),1)或hstack((a,b))参见https://stackoverflow.com/questions/18404077/concatenating-arrays-in-python-like-matlab-without-knowing -out -out -out -outpu – Tengis