Python 双月数据预测

Python 双月数据预测,python,time-series,forecasting,Python,Time Series,Forecasting,我有一个两年的销售数据,数据如下 Date_time_index Customer exposure. 1/3/2015. 234. 15/3/2015. 560. 1/4/2016. 789. 15/4/2016. 678. 1/5/2017 222. 15/5/2017. 456. Days. Customer_exposure. 15. 23. 14. 560. 15. 789. 14. 678. 15. 222. ce_lm3 = smf.ols(cust

我有一个两年的销售数据,数据如下

Date_time_index Customer exposure.
 1/3/2015. 234.
 15/3/2015. 560.
 1/4/2016. 789.
 15/4/2016. 678.
 1/5/2017 222.
 15/5/2017. 456. 
Days. Customer_exposure.
 15. 23.
 14. 560.
 15. 789.
 14. 678.
 15. 222.



ce_lm3 = smf.ols(customer_exposure~ days', data=differenced_series).fit()
所以基本上我想预测2018年数据的双峰销售额

由于python不接受回归的日期-时间索引,并且如果我将日期转换为天数,数据如下所示

Date_time_index Customer exposure.
 1/3/2015. 234.
 15/3/2015. 560.
 1/4/2016. 789.
 15/4/2016. 678.
 1/5/2017 222.
 15/5/2017. 456. 
Days. Customer_exposure.
 15. 23.
 14. 560.
 15. 789.
 14. 678.
 15. 222.



ce_lm3 = smf.ols(customer_exposure~ days', data=differenced_series).fit()
上述将双峰数据转换为天数对我来说似乎不太正确和明智,有谁能建议我如何将该时间序列指数转换为天数,以便预测2018年客户的风险敞口

注意,,:我无法将日期时间索引转换为月数,因为这是一个双月数据,而不是每月或任何其他级别的数据。这严格要求是双月数据


提前感谢在
datetime
模块中的
datetime
对象有一个有用的函数
strtime()
,它允许使用
格式
参数将字符串转换为
datetime
对象:

>>> from datetime import datetime
>>> a = datetime.strptime('1/3/2015', '%d/%m/%Y')
>>> b = datetime.strptime('15/3/2015', '%d/%m/%Y')
>>> print (b-a).days
14