df.fillna(method='pad') replaces the missing value by the value _____the missing value.
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'.
Related questions:
2026: 29 May Shift 1
2026: 21 May Shift 1
2026: 24 May Shift 1