Reputation: 39
I have this dataFrame:
How can I filter column G, to exclude rows that the value is in column C? The result should look like this:
Upvotes: -2
Views: 55
Reputation: 18367
You can use a mask in this case:
df_filtered = df[~df['G'].isin(df['C'])]
Upvotes: 2
Reputation: 787
Try df.loc with isin + ~ which negates it
df.loc[~df['G'].isin(df['C'].unique())]
Upvotes: 3