热线电话:13121318867

登录
2018-12-19 阅读量: 736
执行线性插值

interpolate() 默认情况下,Series和DataFrame对象都会在缺少的数据点处执行线性插值。

In [60]: ts

Out[60]:

2000-01-31 0.469112

2000-02-29 NaN

2000-03-31 NaN

2000-04-28 NaN

2000-05-31 NaN

2000-06-30 NaN

2000-07-31 NaN

...

2007-10-31 -3.305259

2007-11-30 -5.485119

2007-12-31 -6.854968

2008-01-31 -7.809176

2008-02-29 -6.346480

2008-03-31 -8.089641

2008-04-30 -8.916232

Freq: BM, Length: 100, dtype: float64

In [61]: ts.count()

Out[61]: 61

In [62]: ts.interpolate().count()

Out[62]: 100

In [63]: ts.interpolate().plot()

Out[63]: <matplotlib.axes._subplots.AxesSubplot at 0x7f20cf59ca58>

0.0000
5
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子