Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个具有相同行数的 numpy 数组 A 和 B。我想要一个新的数组 C,它是 B 在右侧附加的 A。我找不到执行此操作的函数。我该怎么做?
>>> import numpy as np >>> a = np.array([[1, 2, 3], [4, 5, 6]]) >>> b = np.array([[7, 8, 9], [10, 11, 12]]) >>> np.hstack( (a, b) ) array([[ 1, 2, 3, 7, 8, 9], [ 4, 5, 6, 10, 11, 12]])