I have a two-column DataFrame, I want to select the rows with NaN
in either column.
I used this method df[ (df['a'] == np.NaN) | (df['b'] == np.NaN) ]
However it returns an empty answer. I don't know what's the problem
You need isnull
for finding NaN
values:
df[ (df['a'].isnull()) | (df['b'].isnull()) ]
Docs.
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