I have two lines of code that I want to simplify into one:
df1 = df[df.column1.isin(values) == False]
df2 = df1[df1.column2.isin(values) == False]
Preferably, I don't want to have to create df2 at all.
I have two lines of code that I want to simplify into one:
df1 = df[df.column1.isin(values) == False]
df2 = df1[df1.column2.isin(values) == False]
Preferably, I don't want to have to create df2 at all.
For avoid df1 chain both conditions by & for bitwise AND, instead compare by False invert mask by ~:
df2 = df[~df.column1.isin(values) & ~df.column2.isin(values)]