What does .dropna(how='all') do?
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.
Related questions:
2026: 19 May Shift 1
2025: 20 May Shift 1
2026: 18 May Shift 2
2025: 13 May Shift 2
2025: 16 May Shift 1