ComeçarComece de graça

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.

Este exercício faz parte do curso

Dealing with Missing Data in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Print prior to interpolation
print(airquality[30:40])

# Interpolate the NaNs linearly
airquality.interpolate(___, inplace=True)

# Print after interpolation
print(airquality[30:40])
Editar e executar o código