code: def _merge_X(df, X):
      """Merge X and df on the DatetimeIndex.
  
      Parameters
      ----------
      fh : sktime.ForecastingHorizon
      X : pd.DataFrame
          Exogeneous data
      df : pd.DataFrame
          Contains a DatetimeIndex column "ds"
  
      Returns
      -------
      pd.DataFrame
          DataFrame with containing X and df (with a DatetimeIndex column "ds")
  
      Raises
      ------
      TypeError
          Error if merging was not possible
      """
      # Merging on the index is unreliable, possibly due to loss of freq information in fh
      X.columns = X.columns.astype(str)
      if "ds" in X.columns and pd.api.types.is_numeric_dtype(X["ds"]):
          longest_column_name = max(X.columns, key=len)
          X.loc[:, str(longest_column_name) + "_"] = X.loc[:, "ds"]
          # raise ValueError("Column name 'ds' is reserved in prophet")
      X.loc[:, "ds"] = X.index
      df = df.merge(X, how="inner", on="ds", copy=True)
      X = X.drop(columns="ds")
      return df, X
  
imports: import os
  import pandas
  from sktime.forecasting.base import BaseForecaster
label_desc: Use image node_id 1 for calling a global function with example usage: _merge_X(df, X) and returns: df,  X