Get startedGet started for free

Filling missing time-series data

Imputing time-series data requires a specialized treatment. Time-series data usually comes with special characteristics such trend, seasonality and cyclicality of which we can exploit when imputing missing values in the data. In the airquality DataFrame, you can observe these characteristics. Your goal is to impute the values in such a way that these characteristics are accounted for.

In this exercise, you'll try using the .fillna() method to impute time-series data. You will use the forward fill and backward fill strategies for imputing time series data.

This exercise is part of the course

Dealing with Missing Data in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Print prior to imputing missing values
print(airquality[30:40])

# Fill NaNs using forward fill
airquality.___(___, inplace=True)

# Print after imputing missing values
print(airquality[30:40])
Edit and Run Code