📅  最后修改于: 2022-03-11 14:45:28.803000             🧑  作者: Mango
m = {'left_only': 'df1', 'right_only': 'df2', 'both': 'df1, df2'}
result = df1.merge(df2, on=['A'], how='outer', indicator='B')
result['B'] = result['B'].map(m)
result