外推和内插Pandas DataFrame

问题描述

我有一个如下所示的熊猫数据框

enter image description here

(年份索引为int64,Total_Population_Final为float。)

我想创建线性插值(和外推),但是使用pd.interpolate()我似乎只能在两年之间创建插值(不能在时间上向前和向后扩展)。

解决方法

更新:我已经使用以下方法解决了此问题(对于有兴趣的人供以后参考)

pd.interpolate(方法=“样条曲线”,顺序= 1,limit_direction =“两者”)