Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Dealing with Missing Data in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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])
Code bewerken en uitvoeren