4

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?

Chia Yi
  • 562
  • 2
  • 7
  • 21

1 Answers1

0

Invert mask by ~:

df[~(df['a'].isnull() & df['b'].isnull())]

Or:

df[df[['a','b']].notnull().any(1)]
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252