I have 2 dataframes
df1
Cols/Rows A B C
0 A 50 150 200
1 B 200 250 300
2 C 350 400 450
df2
Cols/Rows A B C
0 A 50 150 200
1 B 200 300 300
2 C 370 400 450
My expected output
Cols/Rows A A2 B B2 C C2
0 A 50 50 150 150 200 200
1 B 200 200 250 300 300 300
2 C 350 370 400 400 450 450
I want to create new dataframe merging both with col and row wise. I tried to use merge()
but it didn't worked
print(df2.merge(df1, how='left'))
merge
have suffixes
df1.merge(df2,on='Cols/Rows',suffixes =['','2'],how='left')
Out[225]:
Cols/Rows A B C A2 B2 C2
0 A 50 150 200 50 150 200
1 B 200 250 300 200 300 300
2 C 350 400 450 370 400 450
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With