目录
1.横向拼接 hstack()
import numpy as np
arr1=np.arange(6).reshape(2,3)
arr2=np.array([[1,2,3],[2,3,4]])
print('arr1:',arr1)
print('arr2:',arr2)
#横向拼接
arr_new=np.hstack((arr1,arr2))
print('arr_new:',arr_new)
2.纵向拼接 vstack()
arr_new=np.vstack((arr1,arr2))
print('arr_new:',arr_new)
3.concatenate()
#横向拼接
arr_new=np.concatenate((arr1,arr2),axis=1)
print(arr_new)
#纵向拼接
arr_new=np.concatenate((arr1,arr2),axis=0)
print(arr_new)