我对用Python和Prophet做时间序列非常陌生。我有一个带有变量的数据集文章代码,日期和销售数量。我试图用python中的Prophet来预测每个月每件商品的销售量。dataset"/>
我尝试使用for循环为每一篇文章执行预测,但是我不确定如何在输出(forecast)数据中显示文章类型,以及如何直接从“for循环”将其写入文件。在df2 = df2.rename(columns={'Date of the document': 'ds','Quantity sold': 'y'})
for article in df2['Article bar code']:
# set the uncertainty interval to 95% (the Prophet default is 80%)
my_model = Prophet(weekly_seasonality= True, daily_seasonality=True,seasonality_prior_scale=1.0)
my_model.fit(df2)
future_dates = my_model.make_future_dataframe(periods=6, freq='MS')
forecast = my_model.predict(future_dates)
return forecast
我希望输出如下所示,并希望将其直接从“for循环”写入输出文件。在
提前谢谢。在