Skip to main contentSkip to solution

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

Solution

✅ Correct Option: 1

In pandas, fillna(method='pad') is a forward fill. Each missing value (NaN) is replaced by the last valid value that appears before it in the column or row. It is the same as ffill.

For example, [5, NaN, NaN, 8] becomes [5, 5, 5, 8].


Option 2: this is method='bfill' (or 'backfill'), which fills from the next valid value.

Option 4: this is fillna(value), for example fillna(0), where a fixed value is passed.

Keyboard Shortcuts

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