class_docstr: Wrapper to apply Scikit-learn transformers to a selected group of variables. It
  supports the following transformers:
  
  - Binarizer and KBinsDiscretizer (only when encoding=Ordinal)
  - FunctionTransformer, PowerTransformer and QuantileTransformer
  - SimpleImputer, IterativeImputer and KNNImputer (only when add_indicators=False)
  - OrdinalEncoder and OneHotEncoder (only when sparse is False)
  - MaxAbsScaler, MinMaxScaler, StandardScaler, RobustScaler, Normalizer
  - All selection transformers including VarianceThreshold
  - PolynomialFeautures
  
  More details in the :ref:`User Guide <sklearn_wrapper>`.
  
  Parameters
  ----------
  transformer: sklearn transformer
      The desired Scikit-learn transformer.
  
  variables: list, default=None
      The list of variables to be transformed. If None, the wrapper will select all
      variables of type numeric for all transformers, except the SimpleImputer,
      OrdinalEncoder and OneHotEncoder, in which case, it will select all variables
      in the dataset.
  
  Attributes
  ----------
  transformer_:
      The fitted Scikit-learn transformer.
  
  variables_:
      The group of variables that will be transformed.
  
  features_to_drop_:
      The variables that will be dropped. Only present when using selection
      transformers
  
  feature_names_in_:
      List with the names of features seen during `fit`.
  
  n_features_in_:
      The number of features in the train set used in fit.
  
  Methods
  -------
  fit:
      Fit Scikit-learn transformer.
  
  fit_transform:
      Fit to data, then transform it.
  
  get_feature_names_out:
      Get output feature names for transformation.
  
  get_params:
      Get parameters for this estimator.
  
  set_params:
      Set the parameters of this estimator.
  
  inverse_transform:
      Convert the data back to the original representation.
  
  transform:
      Transform data with the Scikit-learn transformer.
  
  Notes
  -----
  This transformer offers similar functionality to the ColumnTransformer from
  Scikit-learn, but it allows entering the transformations directly into a
  Pipeline and returns pandas dataframes.
  
  See Also
  --------
  sklearn.compose.ColumnTransformer
class_docstr_tok: ["Wrapper","to","apply","Scikit-learn","transformers","to","a","selected","group","of","variables",".","It","supports","the","following","transformers",":","-","Binarizer","and","KBinsDiscretizer","(","only","when","encoding=Ordinal",")","-","FunctionTransformer",",","PowerTransformer","and","QuantileTransformer","-","SimpleImputer",",","IterativeImputer","and","KNNImputer","(","only","when","add_indicators=False",")","-","OrdinalEncoder","and","OneHotEncoder","(","only","when","sparse","is","False",")","-","MaxAbsScaler",",","MinMaxScaler",",","StandardScaler",",","RobustScaler",",","Normalizer","-","All","selection","transformers","including","VarianceThreshold","-","PolynomialFeautures","More","details","in","the",":","ref",":","`","User","Guide","<","sklearn_wrapper",">","`",".","Parameters","--","--","--","--","--","transformer",":","sklearn","transformer","The","desired","Scikit-learn","transformer",".","variables",":","list",",","default=None","The","list","of","variables","to","be","transformed",".","If","None",",","the","wrapper","will","select","all","variables","of","type","numeric","for","all","transformers",",","except","the","SimpleImputer",",","OrdinalEncoder","and","OneHotEncoder",",","in","which","case",",","it","will","select","all","variables","in","the","dataset",".","Attributes","--","--","--","--","--","transformer_",":","The","fitted","Scikit-learn","transformer",".","variables_",":","The","group","of","variables","that","will","be","transformed",".","features_to_drop_",":","The","variables","that","will","be","dropped",".","Only","present","when","using","selection","transformers","feature_names_in_",":","List","with","the","names","of","features","seen","during","`","fit","`",".","n_features_in_",":","The","number","of","features","in","the","train","set","used","in","fit",".","Methods","--","--","--","-","fit",":","Fit","Scikit-learn","transformer",".","fit_transform",":","Fit","to","data",",","then","transform","it",".","get_feature_names_out",":","Get","output","feature","names","for","transformation",".","get_params",":","Get","parameters","for","this","estimator",".","set_params",":","Set","the","parameters","of","this","estimator",".","inverse_transform",":","Convert","the","data","back","to","the","original","representation",".","transform",":","Transform","data","with","the","Scikit-learn","transformer",".","Notes","--","--","-","This","transformer","offers","similar","functionality","to","the","ColumnTransformer","from","Scikit-learn",",","but","it","allows","entering","the","transformations","directly","into","a","Pipeline","and","returns","pandas","dataframes",".","See","Also","--","--","--","--","sklearn.compose.ColumnTransformer"]
code: def __init__(
      self,
      transformer,
      variables: Union[None, int, str, List[Union[str, int]]] = None,
  ) -> None:
      if not issubclass(transformer.__class__, TransformerMixin):
          raise TypeError(
              "transformer expected a Scikit-learn transformer. "
              f"got {transformer} instead. "
          )
  
      if transformer.__class__.__name__ not in _ALL_TRANSFORMERS:
          raise NotImplementedError(
              "This transformer is not compatible with the wrapper. "
              "Supported transformers are {}.".format(
                  ", ".join(_ALL_TRANSFORMERS)
              )
          )
  
      if (
          transformer.__class__.__name__
          in ["SimpleImputer", "KNNImputer", "IterativeImputer"]
          and transformer.add_indicator is True
      ):
          raise NotImplementedError(
              "The imputer is only compatible with the wrapper when the "
              "parameter `add_indicator` is False. "
          )
  
      if (
          transformer.__class__.__name__ == "KBinsDiscretizer"
          and transformer.encode != "ordinal"
      ):
          raise NotImplementedError(
              "The KBinsDiscretizer is only compatible with the wrapper when the "
              "parameter `encode` is `ordinal`. "
          )
  
      if (
          transformer.__class__.__name__ == "OneHotEncoder"
          and transformer.sparse is True
      ):
          raise NotImplementedError(
              "The SklearnTransformerWrapper can only wrap the OneHotEncoder if the "
              "sparse is set to False."
          )
  
      self.transformer = transformer
      self.variables = _check_init_parameter_variables(variables)
  
file_path: feature_engine/feature_engine/wrappers/wrappers.py
imports: from typing import List, Optional, Union
  import pandas
  from sklearn.base import BaseEstimator, TransformerMixin, clone
  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_all_variables, _find_or_check_numerical_variables
  from feature_engine.dataframe_checks import _check_X_matches_training_df, check_X
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 1 to create a new SklearnTransformerWrapper object from inherited base classes: BaseEstimator, TransformerMixin with example: obj = SklearnTransformerWrapper(transformer, variables)