我有一个numpy矩阵,想将所有行连接起来,以便得到一个长数组。
感谢您的帮助。
#example
input:
[[1 2 3]
[4 5 6}
[7 8 9]]
output:
[[1 2 3 4 5 6 7 8 9]]
我现在的做法似乎不太符合Pythonic的风格,我相信有更好的方法。
combined_x = x[0]
for index, row in enumerate(x):
if index!= 0:
combined_x = np.concatenate((combined_x,x[index]),axis=1)
感谢您的帮助。