0

HJello guys,

I wanzt to do a left join like below, but im gotting date1_x, date1_y and date2_x and date2_y. What i want is to replace the column if it exists.

df1 = df1.merge(df2, on='id', how='left')

df1

id, date1, val1, date2

1,  '2021-03-10', 'XEP', '2021-04-10'

df2

 id,    date1,      date2
 1,  '2021-09-03', '2021-09-04'
 2,  '2021-09-05', '2021-09-06'
 3,  '2021-09-07', '2021-09-08'

expected resulting df:

1,  '2021-09-03', 'XEP' , '2021-09-04'
tamo007
  • 276
  • 1
  • 12

0 Answers0