•hstack(tup) ,参数tup可以是元组,列表,或者numpy数组,返回结果为numpy的数组。
import numpy as np arr1 = np.array([1, 2, 3]) arr2 = np.array([4, 5, 6]) res = np.hstack((arr1, arr2)) print res >>>[1 2 3 4 5 6] arr1 = np.array([[1, 2], [3, 4], [5, 6]]) arr2 = np.array([[7, 8], [9, 0], [0, 1]]) res = np.hstack((arr1, arr2)) print res >>> [[1 2 7 8] [3 4 9 0] [5 6 0 1]]
来源:https://www.cnblogs.com/bozi/p/12295079.html