0

Like we can do this :

df[df['first_name'].notnull() & (df['nationality'] == "USA")]

I want to get portion of dataframe where the rows obey to 2 conditions that the value of column 'A' and column 'B' from df1 doesn't exist in a row from df2 I tried :

df1[~ (df1['A']==df2['A'] & df1['B']==df2['B'])] 
asmatrk
  • 237
  • 2
  • 9
  • 1
    you need `isin` `df1[~ (df1['A'].isin(df2['A')]) & ~(df1['B'].isin(df2['B']) ]` – Umar.H Jun 24 '20 at 10:34
  • Does this answer your question? [How to filter Pandas dataframe using 'in' and 'not in' like in SQL](https://stackoverflow.com/questions/19960077/how-to-filter-pandas-dataframe-using-in-and-not-in-like-in-sql) – Umar.H Jun 24 '20 at 10:35

0 Answers0