Forward Fill in Pandas: Use the Previous Value to Fill the Current Missing Value

Table of Contents

Forward Fill in Pandas: Use the Previous Value to Fill the Current Missing Value

If you want to use the previous value in a column or a row to fill the current missing value in a pandas DataFrame, use df.fillna(method=’ffill’). ffill stands for forward fill.

The code above shows how this method works.

Link to the source code.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran