diff --git a/nbs/src/core/core.ipynb b/nbs/src/core/core.ipynb index 5748b84ff..373879472 100644 --- a/nbs/src/core/core.ipynb +++ b/nbs/src/core/core.ipynb @@ -838,9 +838,9 @@ "#| exporti\n", "def _warn_df_constructor():\n", " warnings.warn(\n", - " \"The `df` argument of the StatsForecast constructor is deprecated \"\n", - " \"and will be removed in a future version. \"\n", - " \"Please pass `df` to the fit/forecast methods instead.\",\n", + " \"The `df` argument of the StatsForecast constructor as well as reusing stored \"\n", + " \"dfs from other methods is deprecated and will raise an error in a future version. \"\n", + " \"Please provide the `df` argument to the corresponding method instead, e.g. fit/forecast.\",\n", " category=DeprecationWarning,\n", " )\n", "\n", @@ -920,8 +920,7 @@ " self.freq = freq\n", " self.n_jobs = n_jobs\n", " self.fallback_model = fallback_model\n", - " self.verbose = verbose \n", - " self.n_jobs == 1\n", + " self.verbose = verbose\n", " if df is not None:\n", " _warn_df_constructor()\n", " self._prepare_fit(df=df, sort_df=sort_df)\n", @@ -941,6 +940,8 @@ " sort_df: bool = True,\n", " ) -> None:\n", " if df is None:\n", + " if not hasattr(self, 'ga'):\n", + " raise ValueError('You must provide the `df` argument.')\n", " _warn_df_constructor()\n", " return\n", " df = ensure_time_dtype(df, 'ds')\n", @@ -1920,16 +1921,6 @@ "assert all('the predictions will have the id as a column' in str(w.message) for w in issued_warnings)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "50d26dc0-5cfa-4328-a7ba-227940204b40", - "metadata": {}, - "outputs": [], - "source": [ - "import statsforecast" - ] - }, { "cell_type": "code", "execution_count": null, @@ -1937,7 +1928,7 @@ "metadata": {}, "outputs": [], "source": [ - "statsforecast.config.id_as_index = False" + "sf_config.id_as_index = False" ] }, { diff --git a/statsforecast/core.py b/statsforecast/core.py index 05a93aa40..d2feb224b 100644 --- a/statsforecast/core.py +++ b/statsforecast/core.py @@ -414,9 +414,9 @@ def _get_n_jobs(n_groups, n_jobs): # %% ../nbs/src/core/core.ipynb 27 def _warn_df_constructor(): warnings.warn( - "The `df` argument of the StatsForecast constructor is deprecated " - "and will be removed in a future version. " - "Please pass `df` to the fit/forecast methods instead.", + "The `df` argument of the StatsForecast constructor as well as reusing stored " + "dfs from other methods is deprecated and will raise an error in a future version. " + "Please provide the `df` argument to the corresponding method instead, e.g. fit/forecast.", category=DeprecationWarning, ) @@ -490,7 +490,6 @@ def __init__( self.n_jobs = n_jobs self.fallback_model = fallback_model self.verbose = verbose - self.n_jobs == 1 if df is not None: _warn_df_constructor() self._prepare_fit(df=df, sort_df=sort_df) @@ -512,6 +511,8 @@ def _prepare_fit( sort_df: bool = True, ) -> None: if df is None: + if not hasattr(self, "ga"): + raise ValueError("You must provide the `df` argument.") _warn_df_constructor() return df = ensure_time_dtype(df, "ds")