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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…