I would like to see the non-matching values of two columns of 2 data frames, and also if possible doing like a distinct count of those values that way won't show them repeated
I got these colums from 2 data frames:
df1:
ID
M1
M1
M2
M2
M3
M4
M5
M5
M6
M6
df2:
ID
M1
M1
M2
M2
M3
M3
expected result:
Output:
M4
M5
M6
Thanks!
CodePudding user response:
He needs what is not in df2
out = df1.loc[~df1.ID.isin(df2.ID)].unique()
CodePudding user response:
You can check with isin
with unique
out = df1.loc[~df1.ID.isin(df2.ID)].unique()