Spaces:
Runtime error
Runtime error
| import pandas as pd | |
| from prophet import Prophet | |
| import numpy as np | |
| class ProphetWrapper(): | |
| def __init__(self): | |
| pass | |
| def forecast(self, ts, n_predict, freq=None): | |
| model = Prophet() | |
| train = ts.rename(columns={'datetime': 'ds'}) | |
| model.fit(train) | |
| future = model.make_future_dataframe(periods=n_predict, freq=freq) | |
| forecasted = model.predict(future) | |
| print(forecasted[-n_predict:]) | |
| return forecasted[-n_predict:] | |