Pandas: join DataFrames on field with different names? [duplicate]

I think what you want is possible using merge. Pass in the keyword arguments for left_on and right_on to tell Pandas which column(s) from each DataFrame to use as keys:

pandas.merge(df1, df2, how='left', left_on=['id_key'], right_on=['fk_key'])

The documentation describes this in more detail on this page.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)