我有一个数组:a = np.array([[1, 2, 3],
[4, 5, 6])
b = np.array([[7, 8],
[9, 10]])我想用预期的结果扩展数组:c = np.array([[1, 2, 3, 7, 8],
[4, 5, 6, 9, 10])
1 回答

子衿沉夜
TA贡献1828条经验 获得超3个赞
您可以使用.hstack:
import numpy as np a = np.array([[1, 2, 3], [4, 5, 6]]) b = np.array([[7, 8], [9, 10]]) c = np.hstack((a, b))print(c)
输出:
[[ 1 2 3 7 8] [ 4 5 6 9 10]]
添加回答
举报
0/150
提交
取消