class_docstr: Transformer base class.
class_docstr_tok: ["Transformer","base","class","."]
docstr: Fit to data, then transform it.
  
  Fits the transformer to X and y and returns a transformed version of X.
  
  State change:
      Changes state to "fitted".
  
  Writes to self:
  _is_fitted : flag is set to True.
  _X : X, coerced copy of X, if remember_data tag is True
      possibly coerced to inner type or update_data compatible type
      by reference, when possible
  model attributes (ending in "_") : dependent on estimator
  
  Parameters
  ----------
  X : time series in sktime compatible data container format
      Data to transform, 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:
      |   `X`    | `tf-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 fit_transform(self, X, y=None):
      """Fit to data, then transform it.
  
      Fits the transformer to X and y and returns a transformed version of X.
  
      State change:
          Changes state to "fitted".
  
      Writes to self:
      _is_fitted : flag is set to True.
      _X : X, coerced copy of X, if remember_data tag is True
          possibly coerced to inner type or update_data compatible type
          by reference, when possible
      model attributes (ending in "_") : dependent on estimator
  
      Parameters
      ----------
      X : time series in sktime compatible data container format
          Data to transform, 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:
          |   `X`    | `tf-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`
      """
      # Non-optimized default implementation; override when a better
      # method is possible for a given algorithm.
      return self.fit(X, y).transform(X, y)
  
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 12 for calling the BaseTransformer obj's underlying member method code with example usage: obj.fit_transform(X, y) and returns: self