如何解决没有周末的Python时间序列预测
我试图在Python中创建一个时间序列预测模型,该模型可以预测将来日期的服务台票证数量,但我注意到由于周末,每天的票证数量一直波动至零。
如何使用ARIMA模型在Python中解决这个问题?这是我的代码:
#convert all the values to Date format
for i in range(len(df.submitdate)):
df.submitdate.iloc[i]=dt.datetime.strptime(df.submitdate.iloc[i],'%m/%d/%Y %H:%M').strftime('%Y-%m-%d')
df.head()
#Adding a new column which will have the number odatf tickets per day
df['totalincidents']=df.groupby('submitdate')['incidentnumber'].transform('count')
#remove incident number from dataframe and drop duplicates
df.drop(['incidentnumber'],axis=1,inplace=True)
df.drop_duplicates(inplace=True)
df2=df
#settintg date as the index
df2=df2.set_index('submitdate')
df2.index=pd.to_datetime(df2.index)
df2.index
print(df2.head())
submitdate
2019-10-02 1101
2019-10-03 1027
2019-10-04 1350
2019-10-05 45
2019-10-06 85
2020-08-26 1773
2020-08-27 1294
2020-08-28 1336
2020-08-29 586
2020-08-30 20
Name: totalincidents,Length: 334,dtype: int64
df2.plot()
pyplot.show()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。