Hello I have this code.
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']]
forecast.tail(365)
ds trend yhat_lower yhat_upper trend_lower trend_upper additive_terms additive_terms_lower additive_terms_upper weekly weekly_lower weekly_upper multiplicative_terms multiplicative_terms_lower multiplicative_terms_upper yhat
307 2022-12-30 01:00:00 8744.804921 4151.683644 19973.732090 8744.804921 8744.804921 3425.715807 3425.715807 3425.715807 3425.715807 3425.715807 3425.715807 0.0 0.0 0.0 12170.520728
308 2022-12-30 02:00:00 8743.882714 3948.935733 20003.308794 8743.882714 8743.882714 3691.081394 3691.081394 3691.081394
So I want to download/export this forecast data as csv file.
from google.colab import files
files.download() # ? what I need do here.
Thanks a lot
CodePudding user response:
forecast.to_csv('forecast.csv')
CodePudding user response:
I found the solution.
forecast = m.predict(future)
forecast_data = forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']]
#forecast.tail(365)
print (forecast_data)
forecast_data.to_csv('myCsv.csv')
f.close()