class_docstr: Transformer for extracting time series features.
  
  The WindowSummarizer transforms input series to features based
  on a provided dictionary of window summarizer, window shifts
  and window lengths.
  
  Parameters
  ----------
  n_jobs : int, optional (default=-1)
      The number of jobs to run in parallel for applying the window functions.
      ``-1`` means using all processors.
  target_cols: list of str, optional (default = None)
      Specifies which columns in X to target for applying the window functions.
      ``None`` will target the first column
  lag_feature: dict of str and list, optional (default = dict containing first lag)
      Dictionary specifying as key the type of function to be used and as value
      the argument `window`.
      For the function `lag`, the argument `window` is an integer or a list of
      integers giving the `lag` values to be used.
      For all other functions, the argument `window` is a list with the arguments
      `lag` and `window length`. `lag` defines how far back in the past the window
      starts, `window length` gives the length of the window across which to apply the
      function. For multiple different windows, provide a list of lists.
  
      Please see below a graphical representation of the logic using the following
      symbols:
  
      ``z`` = time stamp that the window is summarized *to*.
  
      Part of the window if `lag` is between 0 and `1-window_length`, otherwise
      not part of the window.
  
      ``x`` = (other) time stamps in the window which is summarized
  
      ``*`` = observations, past or future, not part of the window
  
      The summarization function is applied to the window consisting of x and
      potentially z.
  
      For `window = [1, 3]`, we have a `lag` of 1 and
      `window_length` of 3 to target the three last days (exclusive z) that were
      observed. Summarization is done across windows like this::
  
      |---------------------------|
      | * * * * * * * * x x x z * |
      |---------------------------|
  
      For `window = [0, 3]`, we have a `lag` of 0 and
      `window_length` of 3 to target the three last days (inclusive z) that
      were observed. Summarization is done across windows like this::
  
      |---------------------------|
      | * * * * * * * * x x z * * |
      |---------------------------|
  
  
      Special case ``lag``: Since lags are frequently used and window length is
      redundant, you only need to provide a list of `lag` values.
      So `window = [1]` will result in the first lag::
  
      |---------------------------|
      | * * * * * * * * * * x z * |
      |---------------------------|
  
      And `window = [1, 4]` will result in the first and fourth lag::
  
      |---------------------------|
      | * * * * * * * x * * x z * |
      |---------------------------|
  
      key: either custom function call (to be provided by user) or
          str corresponding to native pandas window function:
              * "sum",
              * "mean",
              * "median",
              * "std",
              * "var",
              * "kurt",
              * "min",
              * "max",
              * "corr",
              * "cov",
              * "skew",
              * "sem"
              See also: https://pandas.pydata.org/docs/reference/window.html.
          The column generated will be named after the key provided, followed by the
          lag parameter and the window_length (if not a lag).
      second value (window): list of integers
          List containing lag and window_length parameters.
      truncate: str, optional (default = None)
          Defines how to deal with NAs that were created as a result of applying the
          functions in the lag_feature dict across windows that are longer than
          the remaining history of data.
          For example a lag config of [14, 7] cannot be fully applied for the first 20
          observations of the targeted column.
          A lag_feature of [[8, 14], [1, 28]] cannot be correctly applied for the
          first 21 resp. 28 observations of the targeted column. Possible values
          to deal with those NAs:
  
          - None
          - "bfill"
  
          None will keep the NAs generated, and would leave it for the user to choose
          an estimator that can correctly deal with observations with missing values,
          "bfill" will fill the NAs by carrying the first observation backwards.
  
  
  Attributes
  ----------
  truncate_start : int
      See section Parameters - truncate for a more detailed explanation of truncation
      as a result of applying windows of certain lengths across past observations.
      Truncate_start will give the maximum of observations that are filled with NAs
      across all arguments of the lag_feature when truncate is set to None.
  
  Returns
  -------
  X: pd.DataFrame
      Contains all transformed columns as well as non-transformed columns.
      The raw inputs to transformed columns will be dropped.
  self: reference to self
  
  Examples
  --------
  >>> import pandas as pd
  >>> from sktime.transformations.series.summarize import WindowSummarizer
  >>> from sktime.datasets import load_airline, load_longley
  >>> from sktime.forecasting.naive import NaiveForecaster
  >>> from sktime.forecasting.base import ForecastingHorizon
  >>> from sktime.forecasting.compose import ForecastingPipeline
  >>> from sktime.split import temporal_train_test_split
  >>> y = load_airline()
  >>> kwargs = {
  ...     "lag_feature": {
  ...         "lag": [1],
  ...         "mean": [[1, 3], [3, 6]],
  ...         "std": [[1, 4]],
  ...     }
  ... }
  >>> transformer = WindowSummarizer(**kwargs)
  >>> y_transformed = transformer.fit_transform(y)
  
  Example with transforming multiple columns of exogeneous features
  
  >>> y, X = load_longley()
  >>> y_train, y_test, X_train, X_test = temporal_train_test_split(y, X)
  >>> fh = ForecastingHorizon(X_test.index, is_relative=False)
  >>> # Example transforming only X
  >>> pipe = ForecastingPipeline(
  ...     steps=[
  ...         ("a", WindowSummarizer(n_jobs=1, target_cols=["POP", "GNPDEFL"])),
  ...         ("b", WindowSummarizer(n_jobs=1, target_cols=["GNP"], **kwargs)),
  ...         ("forecaster", NaiveForecaster(strategy="drift")),
  ...     ]
  ... )
  >>> pipe_return = pipe.fit(y_train, X_train)
  >>> y_pred1 = pipe_return.predict(fh=fh, X=X_test)
  
  Example with transforming multiple columns of exogeneous features
  as well as the y column
  
  >>> Z_train = pd.concat([X_train, y_train], axis=1)
  >>> Z_test = pd.concat([X_test, y_test], axis=1)
  >>> pipe = ForecastingPipeline(
  ...     steps=[
  ...         ("a", WindowSummarizer(n_jobs=1, target_cols=["POP", "TOTEMP"])),
  ...         ("b", WindowSummarizer(**kwargs, n_jobs=1, target_cols=["GNP"])),
  ...         ("forecaster", NaiveForecaster(strategy="drift")),
  ...     ]
  ... )
  >>> pipe_return = pipe.fit(y_train, Z_train)
  >>> y_pred2 = pipe_return.predict(fh=fh, X=Z_test)
docstr: Fit transformer to X and y.
  
  Private _fit containing the core logic, called from fit
  
  Attributes
  ----------
  truncate_start : int
      See section class WindowSummarizer - Parameters - truncate for a more
      detailed explanation of truncation as a result of applying windows of
      certain lengths across past observations.
      Truncate_start will give the maximum of observations that are filled
      with NAs across all arguments of the lag_feature when truncate is
      set to None.
  
  Returns
  -------
  X: pd.DataFrame
      Contains all transformed columns as well as non-transformed columns.
      The raw inputs to transformed columns will be dropped.
  self: reference to self
docstr_tok: ["Fit","transformer","to","X","and","y",".","Private","_fit","containing","the","core","logic",",","called","from","fit","Attributes","--","--","--","--","--","truncate_start",":","int","See","section","class","WindowSummarizer","-","Parameters","-","truncate","for","a","more","detailed","explanation","of","truncation","as","a","result","of","applying","windows","of","certain","lengths","across","past","observations",".","Truncate_start","will","give","the","maximum","of","observations","that","are","filled","with","NAs","across","all","arguments","of","the","lag_feature","when","truncate","is","set","to","None",".","Returns","--","--","--","-","X",":","pd.DataFrame","Contains","all","transformed","columns","as","well","as","non-transformed","columns",".","The","raw","inputs","to","transformed","columns","will","be","dropped",".","self",":","reference","to","self"]
code: def _fit(self, X, y=None):
      """Fit transformer to X and y.
  
      Private _fit containing the core logic, called from fit
  
      Attributes
      ----------
      truncate_start : int
          See section class WindowSummarizer - Parameters - truncate for a more
          detailed explanation of truncation as a result of applying windows of
          certain lengths across past observations.
          Truncate_start will give the maximum of observations that are filled
          with NAs across all arguments of the lag_feature when truncate is
          set to None.
  
      Returns
      -------
      X: pd.DataFrame
          Contains all transformed columns as well as non-transformed columns.
          The raw inputs to transformed columns will be dropped.
      self: reference to self
      """
      X_name = get_name_list(X)
  
      if self.target_cols is not None:
          if not all(x in X_name for x in self.target_cols):
              missing_cols = [
                  x for x in self.target_cols if x not in X_name
              ]
              raise ValueError(
                  "target_cols "
                  + " ".join(missing_cols)
                  + " specified that do not exist in X."
              )
  
      if self.target_cols is None:
          self._target_cols = [X_name[0]]
      else:
          self._target_cols = self.target_cols
  
      # Convert lag config dictionary to pandas dataframe
      if self.lag_feature is None:
          func_dict = pd.DataFrame(
              {
                  "lag": [1],
              }
          ).T.reset_index()
      else:
          func_dict = pd.DataFrame.from_dict(
              self.lag_feature, orient="index"
          ).reset_index()
  
      func_dict = pd.melt(
          func_dict,
          id_vars="index",
          value_name="window",
          ignore_index=False,
      )
      func_dict.sort_index(inplace=True)
      func_dict.drop("variable", axis=1, inplace=True)
      func_dict.rename(
          columns={"index": "summarizer"},
          inplace=True,
      )
      func_dict = func_dict.dropna(axis=0, how="any")
      # Identify lags (since they can follow special notation)
      lags = func_dict["summarizer"] == "lag"
      # Convert lags to default list notation with window_length 1
      boost_lag = func_dict.loc[lags, "window"].apply(
          lambda x: [int(x), 1]
      )
      func_dict.loc[:, "window"] = func_dict["window"].astype("object")
      func_dict.loc[lags, "window"] = boost_lag
      self.truncate_start = (
          func_dict["window"].apply(lambda x: x[0] + x[1] - 1).max()
      )
      self._func_dict = func_dict
  
imports: import pandas
  from joblib import Parallel, delayed
  from sktime.split import ExpandingWindowSplitter, SlidingWindowSplitter
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.multiindex import flatten_multiindex
label_desc: Use image node_id 2 for calling the WindowSummarizer obj's underlying member method code with example usage: obj._fit(X, y) without return types