0
我有一个每日时间序列数据。我试图通过乘以一些月度因素来纠正这些时间系列值。处理熊猫的时间序列数据
我的时间序列数据的样子:
model:
2010-01-30 0.008909
2010-01-31 0.007562
2010-02-01 0.
2010-02-02 0.010286
2010-02-03 0.012244
2010-02-04 0.011367
2010-02-05 0.010800
2010-02-06 0.007610
2010-02-07 0.006534
2010-02-08 0.004721
...
2015-12-02 0.005415
2015-12-03 0.004358
2015-12-04 0.006844
2015-12-05 0.002373
我有一个每月因素,如:
mon_slope:
month
January -0.168627
February -0.165102
March -0.112321
April -0.112232
May -0.080092
June -0.129905
July -0.078751
August -0.095756
September -0.090188
October -0.109919
November -0.155380
December -0.137885
Name: slope, dtype: float64
我所做的:
jan_corr = pd.DataFrame(model[model.index.month ==1]*mon_slope.ix[0][1])
feb_corr = pd.DataFrame(model[model.index.month ==2]*mon_slope.ix[1][1])
mar_corr = pd.DataFrame(model[model.index.month ==3]*mon_slope.ix[2][1])
..................
..................
final = pd.concat([jan_corr,feb_corr,mar_corr])
喜欢它做它喜欢手动校正
但我相信这不是正确的做法。有没有简单的方法来做到这一点:
@COLDSPEED,这就是我一直在寻找。谢谢:) – bikuser
@bikuser很高兴能帮到你! –