We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
SettingWithCopyWarning in Prophet with exogenous data
**Describe the bug**
Running `Prophet` with `X` different from `None` throws the following warning

```python
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  X["ds"] = X.index
/Users/muhlbach/opt/anaconda3/envs/experimental/lib/python3.8/site-packages/sktime/forecasting/base/adapters/_fbprophet.py:190: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
```

Will you please change line 190 in _fbprophet.py to
```python
X.loc[:,"ds"]=X.index
```

Thanks!

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sktime/forecasting/base/adapters/_fbprophet.py`
Content:
```
1 #!/usr/bin/env python3 -u
2 # -*- coding: utf-8 -*-
3 # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
4 
5 __author__ = ["Markus Löning", "Martin Walter"]
6 __all__ = ["_ProphetAdapter"]
7 
8 import os
9 
10 import pandas as pd
11 
12 from sktime.forecasting.base._base import DEFAULT_ALPHA
13 from sktime.forecasting.base._sktime import _OptionalForecastingHorizonMixin
14 from sktime.forecasting.base._sktime import _SktimeForecaster
15 from contextlib import contextmanager
16 
17 
18 class _ProphetAdapter(_OptionalForecastingHorizonMixin, _SktimeForecaster):
19     """Base class for interfacing fbprophet and neuralprophet"""
20 
21     def fit(self, y, X=None, fh=None, **fit_params):
22         """Fit to training data.
23         Parameters
24         ----------
25         y : pd.Series
26             Target time series to which to fit the forecaster.
27         X : pd.DataFrame, optional (default=None)
28             Exogenous variables.
29         fh : int, list or np.array, optional (default=None)
30             The forecasters horizon with the steps ahead to to predict.
31         Returns
32         -------
33         self : returns an instance of self.
34         """
35         self._instantiate_model()
36         self._check_changepoints()
37         self._set_y_X(y, X, enforce_index_type=pd.DatetimeIndex)
38         self._set_fh(fh)
39 
40         # We have to bring the data into the required format for fbprophet:
41         df = pd.DataFrame({"y": y, "ds": y.index})
42 
43         # Add seasonality
44         if self.add_seasonality:
45             self._forecaster.add_seasonality(**self.add_seasonality)
46 
47         # Add country holidays
48         if self.add_country_holidays:
49             self._forecaster.add_country_holidays(**self.add_country_holidays)
50 
51         # Add regressor (multivariate)
52         if X is not None:
53             df, X = _merge_X(df, X)
54             for col in X.columns:
55                 self._forecaster.add_regressor(col)
56 
57         if self.verbose:
58             self._forecaster.fit(df=df, **fit_params)
59         else:
60             with _suppress_stdout_stderr():
61                 self._forecaster.fit(df=df, **fit_params)
62 
63         self._is_fitted = True
64         return self
65 
66     def predict(self, fh=None, X=None, return_pred_int=False, alpha=DEFAULT_ALPHA):
67         """Predict
68 
69         Parameters
70         ----------
71         fh : array-like
72             The forecasters horizon with the steps ahead to to predict.
73             Default is
74             one-step ahead forecast, i.e. np.array([1]).
75         X : pd.DataFrame, optional
76             Exogenous data, by default None
77         return_pred_int : bool, optional
78             Returns a pd.DataFrame with confidence intervalls, by default False
79         alpha : float, optional
80             Alpha level for confidence intervalls, by default DEFAULT_ALPHA
81 
82         Returns
83         -------
84         y_pred : pandas.Series
85             Returns series of predicted values.
86 
87         Raises
88         ------
89         Exception
90             Error when merging data
91         """
92         self.check_is_fitted()
93         self._set_fh(fh)
94         self._update_X(X, enforce_index_type=pd.DatetimeIndex)
95 
96         fh = self.fh.to_absolute(cutoff=self.cutoff).to_pandas()
97         if not isinstance(fh, pd.DatetimeIndex):
98             raise ValueError("absolute `fh` must be represented as a pd.DatetimeIndex")
99         df = pd.DataFrame({"ds": fh}, index=fh)
100 
101         # Merge X with df (of created future DatetimeIndex values)
102         if X is not None:
103             df, X = _merge_X(df, X)
104 
105         # don't compute confidence intervals if not asked for
106         with self._return_pred_int(return_pred_int):
107             out = self._forecaster.predict(df)
108 
109         out.set_index("ds", inplace=True)
110         y_pred = out.loc[:, "yhat"]
111 
112         if return_pred_int:
113             pred_int = out.loc[:, ["yhat_lower", "yhat_upper"]]
114             pred_int.columns = pred_int.columns.str.strip("yhat_")
115             return y_pred, pred_int
116         else:
117             return y_pred
118 
119     def get_fitted_params(self):
120         """Get fitted parameters
121 
122         Returns
123         -------
124         fitted_params : dict
125 
126         References
127         ----------
128         https://facebook.github.io/prophet/docs/additional_topics.html
129         """
130         self.check_is_fitted()
131         fitted_params = {}
132         for name in ["k", "m", "sigma_obs"]:
133             fitted_params[name] = self._forecaster.params[name][0][0]
134         for name in ["delta", "beta"]:
135             fitted_params[name] = self._forecaster.params[name][0]
136         return fitted_params
137 
138     def _check_changepoints(self):
139         """Checking arguments for changepoints and assign related arguments
140 
141         Returns
142         -------
143         self
144         """
145         if self.changepoints is not None:
146             self.changepoints = pd.Series(pd.to_datetime(self.changepoints), name="ds")
147             self.n_changepoints = len(self.changepoints)
148             self.specified_changepoints = True
149         else:
150             self.specified_changepoints = False
151         return self
152 
153     @contextmanager
154     def _return_pred_int(self, return_pred_int):
155         if not return_pred_int:
156             # setting uncertainty samples to zero avoids computing pred ints
157             self._forecaster.uncertainty_samples = 0
158         try:
159             yield
160         finally:
161             if not return_pred_int:
162                 self._forecaster.uncertainty_samples = self.uncertainty_samples
163 
164 
165 def _merge_X(df, X):
166     """Merge X and df on the DatetimeIndex
167 
168     Parameters
169     ----------
170     fh : sktime.ForecastingHorizon
171     X : pd.DataFrame
172         Exog data
173     df : pd.DataFrame
174         Contains a DatetimeIndex column "ds"
175 
176     Returns
177     -------
178     pd.DataFrame
179         DataFrame with containing X and df (with a DatetimeIndex column "ds")
180 
181     Raises
182     ------
183     TypeError
184         Error if merging was not possible
185     """
186     # Merging on the index is unreliable, possibly due to loss of freq information in fh
187     X.columns = X.columns.astype(str)
188     if "ds" in X.columns:
189         raise ValueError("Column name 'ds' is reserved in fbprophet")
190     X["ds"] = X.index
191     # df = df.merge(X, how="inner", on="ds", copy=False)
192     df = df.merge(X, how="inner", on="ds")
193     return df, X.drop(columns="ds")
194 
195 
196 class _suppress_stdout_stderr(object):
197     """
198     A context manager for doing a "deep suppression" of stdout and stderr in
199     Python, i.e. will suppress all print, even if the print originates in a
200     compiled C/Fortran sub-function.
201        This will not suppress raised exceptions, since exceptions are printed
202     to stderr just before a script exits, and after the context manager has
203     exited (at least, I think that is why it lets exceptions through).
204 
205     References
206     ----------
207     https://github.com/facebook/prophet/issues/223
208     """
209 
210     def __init__(self):
211         # Open a pair of null files
212         self.null_fds = [os.open(os.devnull, os.O_RDWR) for x in range(2)]
213         # Save the actual stdout (1) and stderr (2) file descriptors.
214         self.save_fds = [os.dup(1), os.dup(2)]
215 
216     def __enter__(self):
217         # Assign the null pointers to stdout and stderr.
218         os.dup2(self.null_fds[0], 1)
219         os.dup2(self.null_fds[1], 2)
220 
221     def __exit__(self, *_):
222         # Re-assign the real stdout/stderr back to (1) and (2)
223         os.dup2(self.save_fds[0], 1)
224         os.dup2(self.save_fds[1], 2)
225         # Close the null files
226         for fd in self.null_fds + self.save_fds:
227             os.close(fd)
228
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sktime/forecasting/base/adapters/_fbprophet.py b/sktime/forecasting/base/adapters/_fbprophet.py
--- a/sktime/forecasting/base/adapters/_fbprophet.py
+++ b/sktime/forecasting/base/adapters/_fbprophet.py
@@ -187,7 +187,7 @@
     X.columns = X.columns.astype(str)
     if "ds" in X.columns:
         raise ValueError("Column name 'ds' is reserved in fbprophet")
-    X["ds"] = X.index
+    X.loc[:, "ds"] = X.index
     # df = df.merge(X, how="inner", on="ds", copy=False)
     df = df.merge(X, how="inner", on="ds")
     return df, X.drop(columns="ds")

{"golden_diff": "diff --git a/sktime/forecasting/base/adapters/_fbprophet.py b/sktime/forecasting/base/adapters/_fbprophet.py\n--- a/sktime/forecasting/base/adapters/_fbprophet.py\n+++ b/sktime/forecasting/base/adapters/_fbprophet.py\n@@ -187,7 +187,7 @@\n     X.columns = X.columns.astype(str)\n     if \"ds\" in X.columns:\n         raise ValueError(\"Column name 'ds' is reserved in fbprophet\")\n-    X[\"ds\"] = X.index\n+    X.loc[:, \"ds\"] = X.index\n     # df = df.merge(X, how=\"inner\", on=\"ds\", copy=False)\n     df = df.merge(X, how=\"inner\", on=\"ds\")\n     return df, X.drop(columns=\"ds\")\n", "issue": "SettingWithCopyWarning in Prophet with exogenous data\n**Describe the bug**\r\nRunning `Prophet` with `X` different from `None` throws the following warning\r\n\r\n```python\r\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\r\n  X[\"ds\"] = X.index\r\n/Users/muhlbach/opt/anaconda3/envs/experimental/lib/python3.8/site-packages/sktime/forecasting/base/adapters/_fbprophet.py:190: SettingWithCopyWarning: \r\nA value is trying to be set on a copy of a slice from a DataFrame.\r\nTry using .loc[row_indexer,col_indexer] = value instead\r\n```\r\n\r\nWill you please change line 190 in _fbprophet.py to\r\n```python\r\nX.loc[:,\"ds\"]=X.index\r\n```\r\n\r\nThanks!\n", "before_files": [{"content": "#!/usr/bin/env python3 -u\n# -*- coding: utf-8 -*-\n# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)\n\n__author__ = [\"Markus L\u00f6ning\", \"Martin Walter\"]\n__all__ = [\"_ProphetAdapter\"]\n\nimport os\n\nimport pandas as pd\n\nfrom sktime.forecasting.base._base import DEFAULT_ALPHA\nfrom sktime.forecasting.base._sktime import _OptionalForecastingHorizonMixin\nfrom sktime.forecasting.base._sktime import _SktimeForecaster\nfrom contextlib import contextmanager\n\n\nclass _ProphetAdapter(_OptionalForecastingHorizonMixin, _SktimeForecaster):\n    \"\"\"Base class for interfacing fbprophet and neuralprophet\"\"\"\n\n    def fit(self, y, X=None, fh=None, **fit_params):\n        \"\"\"Fit to training data.\n        Parameters\n        ----------\n        y : pd.Series\n            Target time series to which to fit the forecaster.\n        X : pd.DataFrame, optional (default=None)\n            Exogenous variables.\n        fh : int, list or np.array, optional (default=None)\n            The forecasters horizon with the steps ahead to to predict.\n        Returns\n        -------\n        self : returns an instance of self.\n        \"\"\"\n        self._instantiate_model()\n        self._check_changepoints()\n        self._set_y_X(y, X, enforce_index_type=pd.DatetimeIndex)\n        self._set_fh(fh)\n\n        # We have to bring the data into the required format for fbprophet:\n        df = pd.DataFrame({\"y\": y, \"ds\": y.index})\n\n        # Add seasonality\n        if self.add_seasonality:\n            self._forecaster.add_seasonality(**self.add_seasonality)\n\n        # Add country holidays\n        if self.add_country_holidays:\n            self._forecaster.add_country_holidays(**self.add_country_holidays)\n\n        # Add regressor (multivariate)\n        if X is not None:\n            df, X = _merge_X(df, X)\n            for col in X.columns:\n                self._forecaster.add_regressor(col)\n\n        if self.verbose:\n            self._forecaster.fit(df=df, **fit_params)\n        else:\n            with _suppress_stdout_stderr():\n                self._forecaster.fit(df=df, **fit_params)\n\n        self._is_fitted = True\n        return self\n\n    def predict(self, fh=None, X=None, return_pred_int=False, alpha=DEFAULT_ALPHA):\n        \"\"\"Predict\n\n        Parameters\n        ----------\n        fh : array-like\n            The forecasters horizon with the steps ahead to to predict.\n            Default is\n            one-step ahead forecast, i.e. np.array([1]).\n        X : pd.DataFrame, optional\n            Exogenous data, by default None\n        return_pred_int : bool, optional\n            Returns a pd.DataFrame with confidence intervalls, by default False\n        alpha : float, optional\n            Alpha level for confidence intervalls, by default DEFAULT_ALPHA\n\n        Returns\n        -------\n        y_pred : pandas.Series\n            Returns series of predicted values.\n\n        Raises\n        ------\n        Exception\n            Error when merging data\n        \"\"\"\n        self.check_is_fitted()\n        self._set_fh(fh)\n        self._update_X(X, enforce_index_type=pd.DatetimeIndex)\n\n        fh = self.fh.to_absolute(cutoff=self.cutoff).to_pandas()\n        if not isinstance(fh, pd.DatetimeIndex):\n            raise ValueError(\"absolute `fh` must be represented as a pd.DatetimeIndex\")\n        df = pd.DataFrame({\"ds\": fh}, index=fh)\n\n        # Merge X with df (of created future DatetimeIndex values)\n        if X is not None:\n            df, X = _merge_X(df, X)\n\n        # don't compute confidence intervals if not asked for\n        with self._return_pred_int(return_pred_int):\n            out = self._forecaster.predict(df)\n\n        out.set_index(\"ds\", inplace=True)\n        y_pred = out.loc[:, \"yhat\"]\n\n        if return_pred_int:\n            pred_int = out.loc[:, [\"yhat_lower\", \"yhat_upper\"]]\n            pred_int.columns = pred_int.columns.str.strip(\"yhat_\")\n            return y_pred, pred_int\n        else:\n            return y_pred\n\n    def get_fitted_params(self):\n        \"\"\"Get fitted parameters\n\n        Returns\n        -------\n        fitted_params : dict\n\n        References\n        ----------\n        https://facebook.github.io/prophet/docs/additional_topics.html\n        \"\"\"\n        self.check_is_fitted()\n        fitted_params = {}\n        for name in [\"k\", \"m\", \"sigma_obs\"]:\n            fitted_params[name] = self._forecaster.params[name][0][0]\n        for name in [\"delta\", \"beta\"]:\n            fitted_params[name] = self._forecaster.params[name][0]\n        return fitted_params\n\n    def _check_changepoints(self):\n        \"\"\"Checking arguments for changepoints and assign related arguments\n\n        Returns\n        -------\n        self\n        \"\"\"\n        if self.changepoints is not None:\n            self.changepoints = pd.Series(pd.to_datetime(self.changepoints), name=\"ds\")\n            self.n_changepoints = len(self.changepoints)\n            self.specified_changepoints = True\n        else:\n            self.specified_changepoints = False\n        return self\n\n    @contextmanager\n    def _return_pred_int(self, return_pred_int):\n        if not return_pred_int:\n            # setting uncertainty samples to zero avoids computing pred ints\n            self._forecaster.uncertainty_samples = 0\n        try:\n            yield\n        finally:\n            if not return_pred_int:\n                self._forecaster.uncertainty_samples = self.uncertainty_samples\n\n\ndef _merge_X(df, X):\n    \"\"\"Merge X and df on the DatetimeIndex\n\n    Parameters\n    ----------\n    fh : sktime.ForecastingHorizon\n    X : pd.DataFrame\n        Exog data\n    df : pd.DataFrame\n        Contains a DatetimeIndex column \"ds\"\n\n    Returns\n    -------\n    pd.DataFrame\n        DataFrame with containing X and df (with a DatetimeIndex column \"ds\")\n\n    Raises\n    ------\n    TypeError\n        Error if merging was not possible\n    \"\"\"\n    # Merging on the index is unreliable, possibly due to loss of freq information in fh\n    X.columns = X.columns.astype(str)\n    if \"ds\" in X.columns:\n        raise ValueError(\"Column name 'ds' is reserved in fbprophet\")\n    X[\"ds\"] = X.index\n    # df = df.merge(X, how=\"inner\", on=\"ds\", copy=False)\n    df = df.merge(X, how=\"inner\", on=\"ds\")\n    return df, X.drop(columns=\"ds\")\n\n\nclass _suppress_stdout_stderr(object):\n    \"\"\"\n    A context manager for doing a \"deep suppression\" of stdout and stderr in\n    Python, i.e. will suppress all print, even if the print originates in a\n    compiled C/Fortran sub-function.\n       This will not suppress raised exceptions, since exceptions are printed\n    to stderr just before a script exits, and after the context manager has\n    exited (at least, I think that is why it lets exceptions through).\n\n    References\n    ----------\n    https://github.com/facebook/prophet/issues/223\n    \"\"\"\n\n    def __init__(self):\n        # Open a pair of null files\n        self.null_fds = [os.open(os.devnull, os.O_RDWR) for x in range(2)]\n        # Save the actual stdout (1) and stderr (2) file descriptors.\n        self.save_fds = [os.dup(1), os.dup(2)]\n\n    def __enter__(self):\n        # Assign the null pointers to stdout and stderr.\n        os.dup2(self.null_fds[0], 1)\n        os.dup2(self.null_fds[1], 2)\n\n    def __exit__(self, *_):\n        # Re-assign the real stdout/stderr back to (1) and (2)\n        os.dup2(self.save_fds[0], 1)\n        os.dup2(self.save_fds[1], 2)\n        # Close the null files\n        for fd in self.null_fds + self.save_fds:\n            os.close(fd)\n", "path": "sktime/forecasting/base/adapters/_fbprophet.py"}], "after_files": [{"content": "#!/usr/bin/env python3 -u\n# -*- coding: utf-8 -*-\n# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)\n\n__author__ = [\"Markus L\u00f6ning\", \"Martin Walter\"]\n__all__ = [\"_ProphetAdapter\"]\n\nimport os\n\nimport pandas as pd\n\nfrom sktime.forecasting.base._base import DEFAULT_ALPHA\nfrom sktime.forecasting.base._sktime import _OptionalForecastingHorizonMixin\nfrom sktime.forecasting.base._sktime import _SktimeForecaster\nfrom contextlib import contextmanager\n\n\nclass _ProphetAdapter(_OptionalForecastingHorizonMixin, _SktimeForecaster):\n    \"\"\"Base class for interfacing fbprophet and neuralprophet\"\"\"\n\n    def fit(self, y, X=None, fh=None, **fit_params):\n        \"\"\"Fit to training data.\n        Parameters\n        ----------\n        y : pd.Series\n            Target time series to which to fit the forecaster.\n        X : pd.DataFrame, optional (default=None)\n            Exogenous variables.\n        fh : int, list or np.array, optional (default=None)\n            The forecasters horizon with the steps ahead to to predict.\n        Returns\n        -------\n        self : returns an instance of self.\n        \"\"\"\n        self._instantiate_model()\n        self._check_changepoints()\n        self._set_y_X(y, X, enforce_index_type=pd.DatetimeIndex)\n        self._set_fh(fh)\n\n        # We have to bring the data into the required format for fbprophet:\n        df = pd.DataFrame({\"y\": y, \"ds\": y.index})\n\n        # Add seasonality\n        if self.add_seasonality:\n            self._forecaster.add_seasonality(**self.add_seasonality)\n\n        # Add country holidays\n        if self.add_country_holidays:\n            self._forecaster.add_country_holidays(**self.add_country_holidays)\n\n        # Add regressor (multivariate)\n        if X is not None:\n            df, X = _merge_X(df, X)\n            for col in X.columns:\n                self._forecaster.add_regressor(col)\n\n        if self.verbose:\n            self._forecaster.fit(df=df, **fit_params)\n        else:\n            with _suppress_stdout_stderr():\n                self._forecaster.fit(df=df, **fit_params)\n\n        self._is_fitted = True\n        return self\n\n    def predict(self, fh=None, X=None, return_pred_int=False, alpha=DEFAULT_ALPHA):\n        \"\"\"Predict\n\n        Parameters\n        ----------\n        fh : array-like\n            The forecasters horizon with the steps ahead to to predict.\n            Default is\n            one-step ahead forecast, i.e. np.array([1]).\n        X : pd.DataFrame, optional\n            Exogenous data, by default None\n        return_pred_int : bool, optional\n            Returns a pd.DataFrame with confidence intervalls, by default False\n        alpha : float, optional\n            Alpha level for confidence intervalls, by default DEFAULT_ALPHA\n\n        Returns\n        -------\n        y_pred : pandas.Series\n            Returns series of predicted values.\n\n        Raises\n        ------\n        Exception\n            Error when merging data\n        \"\"\"\n        self.check_is_fitted()\n        self._set_fh(fh)\n        self._update_X(X, enforce_index_type=pd.DatetimeIndex)\n\n        fh = self.fh.to_absolute(cutoff=self.cutoff).to_pandas()\n        if not isinstance(fh, pd.DatetimeIndex):\n            raise ValueError(\"absolute `fh` must be represented as a pd.DatetimeIndex\")\n        df = pd.DataFrame({\"ds\": fh}, index=fh)\n\n        # Merge X with df (of created future DatetimeIndex values)\n        if X is not None:\n            df, X = _merge_X(df, X)\n\n        # don't compute confidence intervals if not asked for\n        with self._return_pred_int(return_pred_int):\n            out = self._forecaster.predict(df)\n\n        out.set_index(\"ds\", inplace=True)\n        y_pred = out.loc[:, \"yhat\"]\n\n        if return_pred_int:\n            pred_int = out.loc[:, [\"yhat_lower\", \"yhat_upper\"]]\n            pred_int.columns = pred_int.columns.str.strip(\"yhat_\")\n            return y_pred, pred_int\n        else:\n            return y_pred\n\n    def get_fitted_params(self):\n        \"\"\"Get fitted parameters\n\n        Returns\n        -------\n        fitted_params : dict\n\n        References\n        ----------\n        https://facebook.github.io/prophet/docs/additional_topics.html\n        \"\"\"\n        self.check_is_fitted()\n        fitted_params = {}\n        for name in [\"k\", \"m\", \"sigma_obs\"]:\n            fitted_params[name] = self._forecaster.params[name][0][0]\n        for name in [\"delta\", \"beta\"]:\n            fitted_params[name] = self._forecaster.params[name][0]\n        return fitted_params\n\n    def _check_changepoints(self):\n        \"\"\"Checking arguments for changepoints and assign related arguments\n\n        Returns\n        -------\n        self\n        \"\"\"\n        if self.changepoints is not None:\n            self.changepoints = pd.Series(pd.to_datetime(self.changepoints), name=\"ds\")\n            self.n_changepoints = len(self.changepoints)\n            self.specified_changepoints = True\n        else:\n            self.specified_changepoints = False\n        return self\n\n    @contextmanager\n    def _return_pred_int(self, return_pred_int):\n        if not return_pred_int:\n            # setting uncertainty samples to zero avoids computing pred ints\n            self._forecaster.uncertainty_samples = 0\n        try:\n            yield\n        finally:\n            if not return_pred_int:\n                self._forecaster.uncertainty_samples = self.uncertainty_samples\n\n\ndef _merge_X(df, X):\n    \"\"\"Merge X and df on the DatetimeIndex\n\n    Parameters\n    ----------\n    fh : sktime.ForecastingHorizon\n    X : pd.DataFrame\n        Exog data\n    df : pd.DataFrame\n        Contains a DatetimeIndex column \"ds\"\n\n    Returns\n    -------\n    pd.DataFrame\n        DataFrame with containing X and df (with a DatetimeIndex column \"ds\")\n\n    Raises\n    ------\n    TypeError\n        Error if merging was not possible\n    \"\"\"\n    # Merging on the index is unreliable, possibly due to loss of freq information in fh\n    X.columns = X.columns.astype(str)\n    if \"ds\" in X.columns:\n        raise ValueError(\"Column name 'ds' is reserved in fbprophet\")\n    X.loc[:, \"ds\"] = X.index\n    # df = df.merge(X, how=\"inner\", on=\"ds\", copy=False)\n    df = df.merge(X, how=\"inner\", on=\"ds\")\n    return df, X.drop(columns=\"ds\")\n\n\nclass _suppress_stdout_stderr(object):\n    \"\"\"\n    A context manager for doing a \"deep suppression\" of stdout and stderr in\n    Python, i.e. will suppress all print, even if the print originates in a\n    compiled C/Fortran sub-function.\n       This will not suppress raised exceptions, since exceptions are printed\n    to stderr just before a script exits, and after the context manager has\n    exited (at least, I think that is why it lets exceptions through).\n\n    References\n    ----------\n    https://github.com/facebook/prophet/issues/223\n    \"\"\"\n\n    def __init__(self):\n        # Open a pair of null files\n        self.null_fds = [os.open(os.devnull, os.O_RDWR) for x in range(2)]\n        # Save the actual stdout (1) and stderr (2) file descriptors.\n        self.save_fds = [os.dup(1), os.dup(2)]\n\n    def __enter__(self):\n        # Assign the null pointers to stdout and stderr.\n        os.dup2(self.null_fds[0], 1)\n        os.dup2(self.null_fds[1], 2)\n\n    def __exit__(self, *_):\n        # Re-assign the real stdout/stderr back to (1) and (2)\n        os.dup2(self.save_fds[0], 1)\n        os.dup2(self.save_fds[1], 2)\n        # Close the null files\n        for fd in self.null_fds + self.save_fds:\n            os.close(fd)\n", "path": "sktime/forecasting/base/adapters/_fbprophet.py"}]}