I am doing a simple merge in Pandas. The strange part is that in the column on which I am joining from the right dataframe ends up in the result. So I have twice the same info in different columns and have to drop it.
df1.merge(df2.reset_index().rename(columns={'df_name': df2_name'}),
left_on='df_id',
right_on='df2_id').drop('df2_id', axis=1).set_index('index')
As you can see I have to drop df2_id at the end because I end up with dataframe containing both df_id and df2_id.
Isn't it normal the column df2_id not to be added to the result of the merge as it is being used as key?