mirror of https://github.com/microsoft/autogen.git
use ffill in forecasting example
This commit is contained in:
parent
84f1ae7424
commit
e877de6414
|
@ -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()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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"})
|
||||
|
|
|
@ -247,7 +247,7 @@ import statsmodels.api as sm
|
|||
data = sm.datasets.co2.load_pandas().data
|
||||
# data is given in weeks, but the task is to predict monthly, so use monthly averages instead
|
||||
data = 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 values
|
||||
data = data.to_frame().reset_index()
|
||||
num_samples = data.shape[0]
|
||||
time_horizon = 12
|
||||
|
|
Loading…
Reference in New Issue