Skip to content

Instantly share code, notes, and snippets.

@kvnkho
Last active September 6, 2022 03:55
Show Gist options
  • Save kvnkho/15d910ff7353344bb16837d07e28ba0a to your computer and use it in GitHub Desktop.
Save kvnkho/15d910ff7353344bb16837d07e28ba0a to your computer and use it in GitHub Desktop.
from fugue import transform
def forecast_series(df: pd.DataFrame, models) -> pd.DataFrame:
tdf = df.set_index("unique_id")
model = StatsForecast(df=tdf, models=models, freq='D', n_jobs=1)
return model.forecast(7).reset_index()
transform(series.reset_index(),
forecast_series,
params=dict(models=[AutoARIMA()]),
schema="unique_id:int, ds:date, AutoARIMA:float",
partition={"by": "unique_id"},
engine="spark"
).show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment