我有2个数据帧,我想在Pandas中结合,满足两个条件,但我没有成功到达那里。在此先感谢您的帮助!
df1
A B C
0 1 2 3
1 4 5 6
2 7 8 9
df2
A B F
0 1 2 cat
1 4 5 dog
2 7 8 moose
df3
A B C F
0 1 2 3 cat
1 4 5 6 dog
2 7 8 9 moose
尝试失败的merge
失败:
pd.merge(df1, df2, on='A' & 'B', how='left')
pd.merge(df1, df2, on('A' & 'B'), how='left')
pd.merge(df1, df2, on='A' & on='B',how='left')