Impute with interpolate method
Time-series data have trends of ups and downs against time. For this, filling flat series of values using methods like forward fill or backward fill is not suitable. A more apt imputation would be to use methods like linear or quadratic imputation, where the values are filled with incrementing or decrementing values.
In this exercise, you will work with the .interpolate() method on the airquality DataFrame. You will use linear, quadratic and nearest methods. You can also find the detailed list of strategies for interpolation here.
Deze oefening maakt deel uit van de cursus
Dealing with Missing Data in Python
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Print prior to interpolation
print(airquality[30:40])
# Interpolate the NaNs linearly
airquality.interpolate(___, inplace=True)
# Print after interpolation
print(airquality[30:40])