np.hstack 用法

np.hstack将参数元组的元素数组按水平方向进行叠加

import numpy as np

arr1 = np.array([[1,3], [2,4] ])
arr2 = np.array([[1,4], [2,6] ])
res = np.hstack((arr1, arr2))

print (res)

#
[[1 3 1 4]
 [2 4 2 6]]
import numpy as np

arr1 = [1,2,3]
arr2 = [4,5]
arr3 = [6,7]
res = np.hstack((arr1, arr2,arr3)) 
print (res)


#
[1 2 3 4 5 6 7]

 

你可能感兴趣的:(机器学习)