class_docstr: Index subsetting transformer.
  
  In transform, subsets `X` to the indices in `y.index`.
  If `y` is None, returns `X` without subsetting.
  numpy-based `X` are interpreted as having a RangeIndex starting at n,
  where n is the number of numpy rows seen so far through `fit` and `update`.
  Non-pandas types are interpreted as having index as after conversion to pandas,
  via `datatypes.convert_to`, to the `"pd.DataFrame"` sktime type.
  
  Parameters
  ----------
  index_treatment : str, optional, one of "keep" (default) or "remove"
      determines which indices are kept in `Xt = transform(X, y)`
      "keep" = all indices in y also appear in Xt. If not present in X, NA is filled.
      "remove" = only indices that appear in both X and y are present in Xt.
  
  Examples
  --------
  >>> from sktime.transformations.series.subset import IndexSubset
  >>> from sktime.datasets import load_airline
  >>> X = load_airline()[0:32]
  >>> y = load_airline()[24:42]
  >>> transformer = IndexSubset()
  >>> X_subset = transformer.fit_transform(X=X, y=y)
docstr: Transform X and return a transformed version.
  
  private _transform containing the core logic, called from transform
  
  Parameters
  ----------
  X : pd.DataFrame or pd.Series
      Data to be transformed
  y : pd.DataFrame or pd.Series
      Additional data, e.g., labels for transformation
  
  Returns
  -------
  Xt : pd.DataFrame or pd.Series, same type as X
      transformed version of X
code: def _transform(self, X, y=None):
      """Transform X and return a transformed version.
  
      private _transform containing the core logic, called from transform
  
      Parameters
      ----------
      X : pd.DataFrame or pd.Series
          Data to be transformed
      y : pd.DataFrame or pd.Series
          Additional data, e.g., labels for transformation
  
      Returns
      -------
      Xt : pd.DataFrame or pd.Series, same type as X
          transformed version of X
      """
      if y is None:
          return X
  
      X = self._X
  
      index_treatment = self.index_treatment
      ind_X_and_y = X.index.intersection(y.index)
  
      if index_treatment == "remove":
          Xt = X.loc[ind_X_and_y]
      elif index_treatment == "keep":
          Xt = X.loc[ind_X_and_y]
          y_idx_frame = type(X)(index=y.index, dtype="float64")
          Xt = Xt.combine_first(y_idx_frame)
      else:
          raise ValueError(
              f'index_treatment must be one of "remove", "keep", but found'
              f' "{index_treatment}"'
          )
      return Xt
  
file_path: sktime/sktime/transformations/series/subset.py
imports: import pandas
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 2 for calling the IndexSubset obj's underlying member method code with example usage: obj._transform(X, y) and returns: Xt, X