class_docstr: Transformer base class.
class_docstr_tok: ["Transformer","base","class","."]
docstr: Transform X and return a transformed version.
  
  State required:
      Requires state to be "fitted".
  
  Accesses in self:
  _is_fitted : must be True
  _X : optionally accessed, only available if remember_data tag is True
  fitted model attributes (ending in "_") : must be set, accessed by _transform
  
  Parameters
  ----------
  X : time series in sktime compatible data container format
      Data to fit transform to, of sktime type as follows:
      Series: interpreted as single time series
          pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
          if np.ndarray, of shape (n_timepoints) or (n_variables, n_timepoints)
      Panel: pd.DataFrame with 2-level MultiIndex, list of pd.DataFrame,
          pd.DataFrame in long/wide format, or 3D np.ndarray
          if pd.DataFrame with 2-level MultiIndex, index is (instance, time)
          if 3D np.ndarray, of shape (n_instances, n_variables, n_timepoints)
      Hierarchical: pd.DataFrame with 3- or more-level MultiIndex
          highest (rightmost) level  of MultiIndex is time
      for more details on sktime mtype format specifications,
      and additional valid type specifications, refer to
          examples/AA_datatypes_and_datasets.ipynb
  y : optional, time series in sktime compatible data format, default=None
      Additional data, e.g., labels for transformation
      some transformers require this, see class docstring for details
  
  Returns
  -------
  transformed version of X
  type depends on type of X and scitype:transform-output tag:
  
  .. list-table::
      :widths: 35 35 40
      :header-rows: 2
  
      * -
        - `transform`
        -
      * - `X`
        - `-output`
        - type of return
      * - `Series`
        - `Primitives`
        - `pd.DataFrame` (1-row)
      * - `Panel`
        - `Primitives`
        - `pd.DataFrame`
      * - `Series`
        - `Series`
        - `Series`
      * - `Panel`
        - `Series`
        - `Panel`
      * - `Series`
        - `Panel`
        - `Panel`
  
  instances in return correspond to instances in `X`
  combinations not in the table are currently not supported
  
  Explicitly, with examples:
      if `X` is `Series` (e.g., `pd.DataFrame`) and `transform-output` is `Series`
          then the return is a single `Series` of the same mtype
          Example: detrending a single series
      if `X` is `Panel` (e.g., `pd-multiindex`) and `transform-output` is `Series`
          then the return is `Panel` with same number of instances as `X`
              (the transformer is applied to each input Series instance)
          Example: all series in the panel are detrended individually
      if `X` is `Series` or `Panel` and `transform-output` is `Primitives`
          then the return is `pd.DataFrame` with as many rows as instances in `X`
          Example: i-th row of the return has mean and variance of the i-th series
      if `X` is `Series` and `transform-output` is `Panel`
          then the return is a `Panel` object of type `pd-multiindex`
          Example: i-th instance of the output is the i-th window running over `X`
code: def transform(self, X, y=None):
      """Transform X and return a transformed version.
  
      State required:
          Requires state to be "fitted".
  
      Accesses in self:
      _is_fitted : must be True
      _X : optionally accessed, only available if remember_data tag is True
      fitted model attributes (ending in "_") : must be set, accessed by _transform
  
      Parameters
      ----------
      X : time series in sktime compatible data container format
          Data to fit transform to, of sktime type as follows:
          Series: interpreted as single time series
              pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
              if np.ndarray, of shape (n_timepoints) or (n_variables, n_timepoints)
          Panel: pd.DataFrame with 2-level MultiIndex, list of pd.DataFrame,
              pd.DataFrame in long/wide format, or 3D np.ndarray
              if pd.DataFrame with 2-level MultiIndex, index is (instance, time)
              if 3D np.ndarray, of shape (n_instances, n_variables, n_timepoints)
          Hierarchical: pd.DataFrame with 3- or more-level MultiIndex
              highest (rightmost) level  of MultiIndex is time
          for more details on sktime mtype format specifications,
          and additional valid type specifications, refer to
              examples/AA_datatypes_and_datasets.ipynb
      y : optional, time series in sktime compatible data format, default=None
          Additional data, e.g., labels for transformation
          some transformers require this, see class docstring for details
  
      Returns
      -------
      transformed version of X
      type depends on type of X and scitype:transform-output tag:
  
      .. list-table::
          :widths: 35 35 40
          :header-rows: 2
  
          * -
            - `transform`
            -
          * - `X`
            - `-output`
            - type of return
          * - `Series`
            - `Primitives`
            - `pd.DataFrame` (1-row)
          * - `Panel`
            - `Primitives`
            - `pd.DataFrame`
          * - `Series`
            - `Series`
            - `Series`
          * - `Panel`
            - `Series`
            - `Panel`
          * - `Series`
            - `Panel`
            - `Panel`
  
      instances in return correspond to instances in `X`
      combinations not in the table are currently not supported
  
      Explicitly, with examples:
          if `X` is `Series` (e.g., `pd.DataFrame`) and `transform-output` is `Series`
              then the return is a single `Series` of the same mtype
              Example: detrending a single series
          if `X` is `Panel` (e.g., `pd-multiindex`) and `transform-output` is `Series`
              then the return is `Panel` with same number of instances as `X`
                  (the transformer is applied to each input Series instance)
              Example: all series in the panel are detrended individually
          if `X` is `Series` or `Panel` and `transform-output` is `Primitives`
              then the return is `pd.DataFrame` with as many rows as instances in `X`
              Example: i-th row of the return has mean and variance of the i-th series
          if `X` is `Series` and `transform-output` is `Panel`
              then the return is a `Panel` object of type `pd-multiindex`
              Example: i-th instance of the output is the i-th window running over `X`
      """
      # check whether is fitted
      self.check_is_fitted()
  
      # input check and conversion for X/y
      X_inner, y_inner, metadata = self._check_X_y(
          X=X, y=y, return_metadata=True
      )
  
      if not isinstance(X_inner, VectorizedDF):
          Xt = self._transform(X=X_inner, y=y_inner)
      else:
          # otherwise we call the vectorized version of predict
          Xt = self._vectorize("transform", X=X_inner, y=y_inner)
  
      # obtain configs to control input and output control
      configs = self.get_config()
      input_conv = configs["input_conversion"]
      output_conv = configs["output_conversion"]
  
      # convert to output mtype
      if X is None:
          X_out = Xt
      elif input_conv and output_conv:
          X_out = self._convert_output(Xt, metadata=metadata)
      else:
          X_out = Xt
  
      return X_out
  
imports: from itertools import product
  from typing import Union
  import numpy
  import pandas
  from sktime.base import BaseEstimator
  from sktime.datatypes import VectorizedDF, check_is_error_msg, check_is_mtype, check_is_scitype, convert, convert_to, mtype_to_scitype, update_data
  from sktime.datatypes._series_as_panel import convert_to_scitype
  from sktime.utils.sklearn import is_sklearn_classifier, is_sklearn_clusterer, is_sklearn_regressor, is_sklearn_transformer
  from sktime.utils.validation._dependencies import _check_estimator_deps
label_desc: Use image node_id 11 for calling the BaseTransformer obj's underlying member method code with example usage: obj.transform(X, y) and returns: X_out