How to save a Holt model forecast in a dataframe in pandas

34 views Asked by At

I have sample data in following format enter image description hereand I am trying to run Holts model on it to forecast ln_value for future 10 time points for each groupby variable 'bid'. I am running following snippet but I am unable to store the forecast in a dataframe. Can someone please help on how to do it? Thanks

def triple_smoothing(g): print(f'Creating model for: {g.bid.iloc[0]}')

model = ExponentialSmoothing(g['ln_val'],trend='add', seasonal=None, damped_trend=True)

fit = model.fit()
fit.summary()
# Forecast
prediction_size = 10
forecast_values = fit.forecast(prediction_size)
print(forecast_values)
print()

df.groupby('bid').apply(triple_smoothing)

enter image description here is what I am expecting in the dataframe

0

There are 0 answers