class_docstr: shared set-up checks and methods across outlier transformers
class_docstr_tok: ["shared","set-up","checks","and","methods","across","outlier","transformers"]
docstr: Cap the variable values.
  
  Parameters
  ----------
  X: pandas dataframe of shape = [n_samples, n_features]
      The data to be transformed.
  
  Returns
  -------
  X_new: pandas dataframe of shape = [n_samples, n_features]
      The dataframe with the capped variables.
docstr_tok: ["Cap","the","variable","values",".","Parameters","--","--","--","--","--","X",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","data","to","be","transformed",".","Returns","--","--","--","-","X_new",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","dataframe","with","the","capped","variables","."]
code: def transform(self, X: pd.DataFrame) -> pd.DataFrame:
      """
      Cap the variable values.
  
      Parameters
      ----------
      X: pandas dataframe of shape = [n_samples, n_features]
          The data to be transformed.
  
      Returns
      -------
      X_new: pandas dataframe of shape = [n_samples, n_features]
          The dataframe with the capped variables.
      """
  
      # check if class was fitted
      X = self._check_transform_input_and_state(X)
  
      # replace outliers
      for feature in self.right_tail_caps_.keys():
          X[feature] = X[feature].clip(
              upper=self.right_tail_caps_[feature]
          )
  
      for feature in self.left_tail_caps_.keys():
          X[feature] = X[feature].clip(
              lower=self.left_tail_caps_[feature]
          )
  
      return X
  
imports: from typing import List, Optional, Union
  import pandas
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.utils.validation import check_is_fitted
  from feature_engine._variable_handling.init_parameter_checks import _check_init_parameter_variables
  from feature_engine._variable_handling.variable_type_selection import _find_or_check_numerical_variables
  from feature_engine.dataframe_checks import _check_contains_inf, _check_contains_na, _check_X_matches_training_df, check_X
  from feature_engine._base_transformers.mixins import GetFeatureNamesOutMixin
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 2 for calling the BaseOutlier obj's underlying member method code with example usage: obj.transform(X) and returns: X