I want to drop rows with null values in both column a and b. I have managed to find those rows with:
df[(df['a'].isnull()) & (df['b'].isnull())]
How do I drop these rows?
I want to drop rows with null values in both column a and b. I have managed to find those rows with:
df[(df['a'].isnull()) & (df['b'].isnull())]
How do I drop these rows?
Invert mask by ~
:
df[~(df['a'].isnull() & df['b'].isnull())]
Or:
df[df[['a','b']].notnull().any(1)]