class_docstr: WindowFeatures adds new features to a dataframe based on window operations. Window
  operations are operations that perform an aggregation over a sliding partition of
  past values. A window feature is, in other words, a feature created after computing
  statistics (e.g., mean, min, max, etc.) using a window over the past data. For
  example, the mean value of the previous 3 months of data is a window feature. The
  maximum value of the previous three rows of data is another window feature.
  
  WindowFeatures uses pandas functions `rolling()`, `agg()` and `shift()`. With
  `rolling()`, it creates rolling windows. With `agg()` it applies multiple functions
  within those windows. With `shift()` it allocates the values to the correct rows.
  
  For supported aggregation functions, see Rolling Window
  `Functions <https://pandas.pydata.org/docs/reference/window.html>`_.
  
  With pandas `rolling()` we can perform rolling operations over 1 window size at a
  time. WindowFeatures builds on top of pandas `rolling()` in that new features can
  be derived from multiple window sizes, and the created features will be
  automatically concatenated to the original dataframe.
  
  To be compatible with WindowFeatures, the dataframe's index must have unique values
  and no missing data.
  
  WindowFeatures works only with numerical variables. You can pass a list of variables
  to use as input for the windows. Alternatively, WindowFeatures will automatically
  select all numerical variables in the training set.
  
  More details in the :ref:`User Guide <window_features>`.
  
  Parameters
  ----------
  {variables}
  
  window: int, offset, BaseIndexer subclass, or list, default=3
      Size of the moving window. If an integer, the fixed number of observations used
      for each window. If an offset (recommended), the time period of each window. It
      can also take a function. See parameter `windows` in pandas `rolling()`
      documentation for more details.
  
      In addition to pandas normal input values, `window` can also take a list with
      the above specified values, in which case, features will be created for each
      one of the windows specified in the list.
  
  min_periods: int, default None.
      Minimum number of observations in the window required to have a value;
      otherwise, the result is np.nan. See parameter `min_periods` in pandas
      `rolling()` documentation for more details.
  
  functions: string or list of strings, default = 'mean'
      The functions to apply within the window. Valid functions can be found
      `here <https://pandas.pydata.org/docs/reference/window.html>`_.
  
  periods: int, list of ints, default=1
      Number of periods to shift. Can be a positive integer. See param `periods` in
      pandas `shift()`.
  
  freq: str, list of str, default=None
      Offset to use from the tseries module or time rule. See parameter `freq` in
      pandas `shift()`.
  
  sort_index: bool, default=True
      Whether to order the index of the dataframe before creating the features.
  
  {missing_values}
  
  {drop_original}
  
  Attributes
  ----------
  variables_:
      The group of variables that will be used to create the window features.
  
  {feature_names_in_}
  
  {n_features_in_}
  
  Methods
  -------
  {fit}
  
  transform:
      Add window features.
  
  {fit_transform}
  
  See Also
  --------
  pandas.rolling
  pandas.aggregate
  pandas.shift
code: def __init__(
      self,
      variables: Union[None, int, str, List[Union[str, int]]] = None,
      window: Union[str, int, Callable, List[int], List[str]] = 3,
      min_periods: Union[int, None] = None,
      functions: Union[str, List[str]] = "mean",
      periods: int = 1,
      freq: Union[str, None] = None,
      sort_index: bool = True,
      missing_values: str = "raise",
      drop_original: bool = False,
  ) -> None:
      if isinstance(window, list) and len(window) != len(set(window)):
          raise ValueError(
              f"There are duplicated windows in the list: {window}"
          )
  
      if not isinstance(functions, (str, list)) or not all(
          isinstance(val, str) for val in functions
      ):
          raise ValueError(
              f"functions must be a string or a list of strings. "
              f"Got {functions} instead."
          )
      if isinstance(functions, list) and len(functions) != len(
          set(functions)
      ):
          raise ValueError(
              f"There are duplicated functions in the list: {functions}"
          )
  
      if not isinstance(periods, int) or periods < 1:
          raise ValueError(
              f"periods must be a positive integer. Got {periods} instead."
          )
  
      super().__init__(variables, missing_values, drop_original)
  
      self.window = window
      self.min_periods = min_periods
      self.functions = functions
      self.periods = periods
      self.freq = freq
      self.sort_index = sort_index
  
file_path: feature_engine/feature_engine/timeseries/forecasting/window_features.py
imports: from typing import Callable, List, Union
  import pandas
  from feature_engine._docstrings.fit_attributes import _feature_names_in_docstring, _n_features_in_docstring
  from feature_engine._docstrings.init_parameters import _drop_original_docstring, _missing_values_docstring, _variables_numerical_docstring
  from feature_engine._docstrings.methods import _fit_not_learn_docstring, _fit_transform_docstring
  from feature_engine._docstrings.substitute import Substitution
  from feature_engine.timeseries.forecasting.base_forecast_transformers import BaseForecastTransformer
label_desc: Use image node_id 1 to create a new WindowFeatures object from inherited base classes: BaseForecastTransformer with example: obj = WindowFeatures(variables, window, min_periods, functions, periods, freq, sort_index, missing_values, drop_original)