A programming framework for agentic AI
use ffill in forecasting example
Chi Wange877de641468
diff --git a/notebook/automl_time_series_forecast.ipynb b/notebook/automl_time_series_forecast.ipynbindex 2909e3f3f..898286b91 100644--- a/notebook/automl_time_series_forecast.ipynb+++ b/notebook/automl_time_series_forecast.ipynb@@ -152,13 +152,11 @@"outputs": [],"source": ["import statsmodels.api as sm\n",- "data = sm.datasets.co2.load_pandas()\n",- "data = data.data\n",+ "data = sm.datasets.co2.load_pandas().data\n","# data is given in weeks, but the task is to predict monthly, so use monthly averages instead\n","data = data['co2'].resample('MS').mean()\n",- "data = data.fillna(data.bfill()) # makes sure there are no missing values\n",- "data = data.to_frame().reset_index()\n",- "# data = data.rename(columns={'index': 'ds', 'co2': 'y'})"+ "data = data.bfill().ffill() # makes sure there are no missing values\n",+ "data = data.to_frame().reset_index()"]},{diff --git a/test/automl/test_forecast.py b/test/automl/test_forecast.pyindex 138412772..0f6f44e64 100644--- a/test/automl/test_forecast.py+++ b/test/automl/test_forecast.py@@ -8,7 +8,8 @@ def test_forecast_automl(budget=5):data = sm.datasets.co2.load_pandas().data["co2"].resample("MS").mean()data = (- data.fillna(data.bfill())+ data.bfill()+ .ffill().to_frame().reset_index().rename(columns={"index": "ds", "co2": "y"})diff --git a/website/docs/Examples/AutoML-Time series forecast.md b/website/docs/Examples/AutoML-Time series forecast.mdindex 47519b6be..72ff979e3 100644--- a/website/docs/Examples/AutoML-Time series forecast.md+++ b/website/docs/Examples/AutoML-Time series forecast.md@@ -247,7 +247,7 @@ import statsmodels.api as smdata = sm.datasets.co2.load_pandas().data# data is given in weeks, but the task is to predict monthly, so use monthly averages insteaddata = data['co2'].resample('MS').mean()-data = data.fillna(data.bfill()) # makes sure there are no missing values+data = data.bfill().ffill() # makes sure there are no missing valuesdata = data.to_frame().reset_index()num_samples = data.shape[0]time_horizon = 12