OJT
OJT

Reputation: 899

Extrapolate (and Interpolate) Pandas DataFrame

I have a pandas dataframe as below

enter image description here

(Year index is int64, Total_Population_Final is float.)

I want to create a linear interpolation (and extrapolation), but using pd.interpolate() I only seem to be able to create an interpolation between the two years (not extending it forward and backward in time).

Upvotes: 2

Views: 2325

Answers (1)

OJT
OJT

Reputation: 899

Update: I have solved this (for anyone interested for future reference), using:

pd.interpolate(method="spline", order=1, limit_direction="both")

Upvotes: 2

Related Questions