I need to forecast with prophet in a "rolling" way. Just to give you the idea, considering a df of shape (2400,2), I want to perform something like:
def forecast(dataframe):
m = Prophet()
m.fit(dataframe)
future = m.make_future_dataframe(
periods=24, freq="H")
forecast = m.predict(future)
return forecast['yhat'][-1]
df['yhat'] = df[['ds','y']].rolling(240).apply(forecast)
Is there a smart way to do that?