October 2019
Beginner to intermediate
674 pages
16h 43m
English
Interpolation is a technique that uses two endpoints at the extremes of consecutive missing values to create a rough mathematical relationship to fill the missing values. By default, it does a linear interpolation (which assumes a linear relationship between data points), but there are many more methods, such as polynomial, spline, quadratic, and Akima (which assumes a polynomial or piece-wise polynomial relationship).
The interpolate method can be applied to a series or all the columns of a DataFrame directly:
import numpy as npimport pandas as pdA=[1,3,np.nan,np.nan,11,np.nan,91,np.nan,52]pd.Series(A).interpolate()
The following is the output:
Instead, ...
Read now
Unlock full access