merge - How to connect two pandas data frames from right and left? -
is there way following in more elegant way (i.e. fewer commands):
df_1 = pandas.dataframe({'col1':[1,2,3], 'col2':[10,20,30]}) df_2 = pandas.dataframe({'col3':[100,200,300], 'col4':[1000,2000,3000]}) col in ['col3','col4']: df_1[col] = df_2[col] print df_1
you can use concat
in [407]: pd.concat([df_1, df_2], axis=1) out[407]: col1 col2 col3 col4 0 1 10 100 1000 1 2 20 200 2000 2 3 30 300 3000
Comments
Post a Comment