外推和内插Pandas DataFrame

问题描述

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

enter image description here

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

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

解决方法

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

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...