How do I drop all dataframe rows that don't match a pair of conditions.
I did this:
df = df[ ! ((df['FVID'] == 0) & (df['vstDelta'] == 0)) ]
but that was a syntax error. Hopefully it illustrates what I want to do, which is to drop all records containing these 2 conditions.
You should use '~' instead of ! to get the negation of the condition.
df = df[~((df['FVID'] == 0) & (df['vstDelta'] == 0))]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With