I am merging two dataframes. The first dataframe looks like this:
A B C Dparty1 asset1 product1 Buyparty1 asset1 product2 Sellparty2 asset2 product1 Buyparty2 asset2 product2 Sell
The second dataframe looks like this:
A B Dparty1 asset1 Buyparty1 asset1 Sellparty2 asset2 Buyparty2 asset2 Sell
I merge the dataframes like this:
df2 = df.merge(df1, on=['A', 'B', 'D'])
which returns:
A B D Cparty1 asset1 Buy product1party1 asset1 Sell product2party2 asset2 Buy product1party2 asset2 Sell product2
I need to replace the values in column 'B' with the values in column 'C' while keeping the same name 'B'.
A B D party1 product1 Buy party1 product2 Sell party2 product1 Buy party2 product2 Sell
Any suggestions on how to achieve this would help.