np.hstack 用法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/G66565906/article/details/84142034

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]

猜你喜欢

转载自blog.csdn.net/G66565906/article/details/84142034