python—机器学习合并数据

千锋 2020-07-04

import numpy as npa = np.arange(6).reshape(2,3)b = np.random.randint(10,20,size=(4,3))#concatenate(array_list,axis=0/1) 沿着指定axis进行数组合并 0为行,1为列,默认为0#np.vstack或者np.row_stack(array_list)按照行合并#np.hstack或者np.column_stack(array_list) 按照列合并c=np.concatenate([a,b])d=np.vstack([a,b])e=np.row_stack([a,b])m= np.arange(6).reshape(3,2)n= np.random.randint(10,20,size=(3,2))p= np.hstack([m,n])q= np.column_stack([m,n])print(p)

相关推荐