Compare Multiple Columns to Get Rows that are Different in Two Pandas Dataframes

后端 未结 4 764
悲哀的现实
悲哀的现实 2021-01-14 16:38

I have two dataframes:

df1=
    A    B   C
0   A0   B0  C0
1   A1   B1  C1
2   A2   B2  C2

df2=
    A    B   C
0   A2   B2  C10
1   A1   B3  C11
2   A9   B4         


        
4条回答
  •  滥情空心
    2021-01-14 17:28

     ~df1['A'].isin(df2['A'])
    

    Should get you the series you want

    df1[ ~df1['A'].isin(df2['A'])]
    

    The dataframe:

        A   B   C
    0   A0  B0  C0
    

提交回复
热议问题