Diff between two dataframes in pandas

后端 未结 5 1447
北荒
北荒 2020-12-17 05:04

I have two dataframes both of which have the same basic schema. (4 date fields, a couple of string fields, and 4-5 float fields). Call them df1 and df2

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-17 05:30

    IIUC:
    You can use pd.Index.symmetric_difference

    pd.concat([df1, df2]).loc[
        df1.index.symmetric_difference(df2.index)
    ]
    

提交回复
热议问题