def predict(
        self,
        h: int,
        X: Optional[np.ndarray] = None,
        level: Optional[Union[int, Tuple[int]]] = None,
    ):
        """Forecast future values using a fitted AutoArima.

        Parameters
        ----------
        h: int
            Number of periods for forecasting.
        X: array-like of shape (h, n_x) optional (default=None)
            Future exogenous variables.
        level: int
            Confidence level for prediction intervals.

        Returns
        -------
        forecasts : pandas dataframe of shape (n, 1 + len(level))
            The array of fitted values.
            The confidence intervals for the forecasts are returned if
            level is not None.
        """
        forecast = forecast_arima(
            self.model_.model,
            h=h,
            xreg=X,
            level=(level,) if isinstance(level, int) else level,
        )

        mean = pd.DataFrame({"mean": forecast["mean"]})

        if level is not None:
            lo = forecast["lower"].add_prefix("lo_")
            hi = forecast["upper"].add_prefix("hi_")

            return pd.concat([lo, mean, hi], axis=1)

        return mean
Forecast future values using a fitted AutoArima.

        Parameters
        ----------
        h: int
            Number of periods for forecasting.
        X: array-like of shape (h, n_x) optional (default=None)
            Future exogenous variables.
        level: int
            Confidence level for prediction intervals.

        Returns
        -------
        forecasts : pandas dataframe of shape (n, 1 + len(level))
            The array of fitted values.
            The confidence intervals for the forecasts are returned if
            level is not None.
        
python/statsforecast/arima.py