📌  相关文章
📜  找出两个 pandas 数据帧之间的差异 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:21.163000             🧑  作者: Mango

代码示例3
# by doing outer, you will get records from both the sides.
f = df1.merge(df2,indicator = True, how='outer').loc[lambda x : x['_merge']!='both']
Out[421]: 
   A  B     _merge
1  2  3  left_only
2  3  4  left_only
3  3  4  left_only

left_unique_result = f.loc[lambda x: x['_merge'] == 'left_only']
right_unique_result = f.loc[lambda x: x['_merge'] == 'right_only']