Spaces:
Running
Running
File size: 449 Bytes
bb4e28f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from neuralprophet import NeuralProphet
import pandas as pd
model = NeuralProphet()
def forecast(
df: pd.DataFrame,
time_col: str = "ds",
value_col: str = "y",
periods: int = 30
) -> pd.DataFrame:
df = df.rename(columns={time_col: "ds", value_col: "y"})
model.fit(df, freq="D")
future = model.make_future_dataframe(df, periods=periods)
forecast_df = model.predict(future)
return forecast_df[["ds", "yhat1"]]
|