Skip to main contentSkip to solution

What does .dropna(how='all') do?

Solution

✅ Correct Option: 1

In pandas, dropna(how='all') removes a row only when every value in that row is missing (NaN). A row with at least one valid value is kept.

For example, a row [NaN, NaN, NaN] is dropped, but [5, NaN, NaN] stays.


Options 2 and 3: these describe how='any', the default, which drops a row if even one value is missing.

Option 4: dropna never deletes the whole DataFrame unless every row is entirely NaN.

Use axis=1 with dropna to apply the same rule to columns instead of rows.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question