I need my output in a dataframe after using a return statement. print () shows my output but return statement gives me : {}
Here is my current code with print working Entire Code with current output
Here is my input dataframe format:
This is my body of the code
prediction = {}
df2 = df.rename(columns={'date': 'ds','load': 'y', 'account': 'article'})
list_articles = df2.article.unique()
def get_prediction(df):
prediction = {}
f2 = df.rename(columns={'date': 'ds','load': 'y', 'account':
'article'})
list_articles = df2.article.unique()
for article in list_articles:
article_df = df2.loc[df2['article'] == article]
my_model = Prophet(weekly_seasonality= True,
daily_seasonality=True,seasonality_prior_scale=1.0)
my_model.fit(article_df)
future_dates = my_model.make_future_dataframe(periods=6, freq='MS')
forecast = my_model.predict(future_dates)
prediction[article] = forecast
return prediction
I need the return statement on prediction to do what print is showing. Currently all that returns using "return prediction" = {} - an empty dictionary