class_docstr: LagFeatures adds lag features to the dataframe. A lag feature is a feature with
  information about a prior time step.
  
  LagFeatures has the same functionality as pandas `shift()` with the exception that
  only one of `periods` or `freq` can be indicated at a time. LagFeatures builds on
  top of pandas `shift()` in that multiple lags can be created at the same time and
  the features with names will be concatenated to the original dataframe.
  
  To be compatible with LagFeatures, the dataframe's index must have unique values
  and no NaN.
  
  LagFeatures works only with numerical variables. You can pass a list of variables
  to lag. Alternatively, LagFeatures will automatically select and lag all numerical
  variables found in the training set.
  
  More details in the :ref:`User Guide <lag_features>`.
  
  Parameters
  ----------
  {variables}
  
  periods: int, list of ints, default=1
      Number of periods to shift. Can be a positive integer or list of positive
      integers. If list, features will be created for each one of the periods in the
      list. If the parameter `freq` is specified, `periods` will be ignored.
  
  freq: str, list of str, default=None
      Offset to use from the tseries module or time rule. See parameter `freq` in
      pandas `shift()`. It is the same functionality. If freq is a list, lag features
      will be created for each one of the frequency values in the list. If freq is not
      None, then this parameter overrides the parameter `periods`.
  
  sort_index: bool, default=True
      Whether to order the index of the dataframe before creating the lag features.
  
  {missing_values}
  
  {drop_original}
  
  Attributes
  ----------
  variables_:
      The group of variables that will be lagged.
  
  {feature_names_in_}
  
  {n_features_in_}
  
  Methods
  -------
  {fit}
  
  {fit_transform}
  
  transform:
      Add lag features.
  
  See Also
  --------
  pandas.shift
docstr: Get names of the lag features.
code: def _get_new_features_name(self) -> List:
      """Get names of the lag features."""
  
      # create the names for the lag features
      if isinstance(self.freq, list):
          feature_names = [
              f"{feature}_lag_{fr}"
              for fr in self.freq
              for feature in self.variables_
          ]
      elif self.freq is not None:
          feature_names = [
              f"{feature}_lag_{self.freq}"
              for feature in self.variables_
          ]
      elif isinstance(self.periods, list):
          feature_names = [
              f"{feature}_lag_{pr}"
              for pr in self.periods
              for feature in self.variables_
          ]
      else:
          feature_names = [
              f"{feature}_lag_{self.periods}"
              for feature in self.variables_
          ]
  
      return feature_names
  
file_path: feature_engine/feature_engine/timeseries/forecasting/lag_features.py
imports: from typing import 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 3 for calling the LagFeatures obj's underlying member method code with example usage: obj._get_new_features_name() and returns: feature_names