Skip to main contentSkip to solution

df.fillna(method='pad') replaces the missing value by the value _____the missing value.

Solution

✅ Correct Option: 2

fillna(method='pad') is a forward fill. It carries the last valid value forward and uses it to replace the missing value that comes after it, so the value used is the one before the missing value.


Option 4: filling from the value after the missing one is backward fill, done with method='bfill' (or 'backfill').

'pad' is the same as 'ffill'.

Keyboard Shortcuts

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