class_docstr: The YeoJohnsonTransformer() applies the Yeo-Johnson transformation to the
  numerical variables.
  
  The Yeo-Johnson transformation implemented by this transformer is that of
  SciPy.stats:
  https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.yeojohnson.html
  
  The YeoJohnsonTransformer() works only with numerical variables.
  
  A list of variables can be passed as an argument. Alternatively, the
  transformer will automatically select and transform all numerical
  variables.
  
  More details in the :ref:`User Guide <yeojohnson>`.
  
  Parameters
  ----------
  {variables}
  
  Attributes
  ----------
  lambda_dict_
      Dictionary containing the best lambda for the Yeo-Johnson per variable.
  
  {variables_}
  
  {feature_names_in_}
  
  {n_features_in_}
  
  Methods
  -------
  fit:
      Learn the optimal lambda for the Yeo-Johnson transformation.
  
  {fit_transform}
  
  transform:
      Apply the Yeo-Johnson transformation.
  
  References
  ----------
  .. [1] Yeo, In-Kwon and Johnson, Richard (2000).
     A new family of power transformations to improve normality or symmetry.
     Biometrika, 87, 954-959.
  
  .. [2] Weisberg S. "Yeo-Johnson Power Transformations".
      https://www.stat.umn.edu/arc/yjpower.pdf
class_docstr_tok: ["The","YeoJohnsonTransformer","(",")","applies","the","Yeo-Johnson","transformation","to","the","numerical","variables",".","The","Yeo-Johnson","transformation","implemented","by","this","transformer","is","that","of","SciPy.stats",":","https",":","\/\/docs.scipy.org\/doc\/scipy\/reference\/generated\/scipy.stats.yeojohnson.html","The","YeoJohnsonTransformer","(",")","works","only","with","numerical","variables",".","A","list","of","variables","can","be","passed","as","an","argument",".","Alternatively",",","the","transformer","will","automatically","select","and","transform","all","numerical","variables",".","More","details","in","the",":","ref",":","`","User","Guide","<","yeojohnson",">","`",".","Parameters","--","--","--","--","--","{","variables","}","Attributes","--","--","--","--","--","lambda_dict_","Dictionary","containing","the","best","lambda","for","the","Yeo-Johnson","per","variable",".","{","variables_","}","{","feature_names_in_","}","{","n_features_in_","}","Methods","--","--","--","-","fit",":","Learn","the","optimal","lambda","for","the","Yeo-Johnson","transformation",".","{","fit_transform","}","transform",":","Apply","the","Yeo-Johnson","transformation",".","References","--","--","--","--","--","..","[","1","]","Yeo",",","In-Kwon","and","Johnson",",","Richard","(","2000",")",".","A","new","family","of","power","transformations","to","improve","normality","or","symmetry",".","Biometrika",",","87",",","954-959",".","..","[","2","]","Weisberg","S.","``","Yeo-Johnson","Power","Transformations","''",".","https",":","\/\/www.stat.umn.edu\/arc\/yjpower.pdf"]
docstr: Learn the optimal lambda for the Yeo-Johnson transformation.
  
  Parameters
  ----------
  X: pandas dataframe of shape = [n_samples, n_features]
      The training input samples. Can be the entire dataframe, not just the
      variables to transform.
  
  y: pandas Series, default=None
      It is not needed in this transformer. You can pass y or None.
docstr_tok: ["Learn","the","optimal","lambda","for","the","Yeo-Johnson","transformation",".","Parameters","--","--","--","--","--","X",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","training","input","samples",".","Can","be","the","entire","dataframe",",","not","just","the","variables","to","transform",".","y",":","pandas","Series",",","default=None","It","is","not","needed","in","this","transformer",".","You","can","pass","y","or","None","."]
code: def fit(self, X: pd.DataFrame, y: Optional[pd.Series] = None):
      """
      Learn the optimal lambda for the Yeo-Johnson transformation.
  
      Parameters
      ----------
      X: pandas dataframe of shape = [n_samples, n_features]
          The training input samples. Can be the entire dataframe, not just the
          variables to transform.
  
      y: pandas Series, default=None
          It is not needed in this transformer. You can pass y or None.
      """
  
      # check input dataframe
      X = super().fit(X)
  
      self.lambda_dict_ = {}
  
      for var in self.variables_:
          _, self.lambda_dict_[var] = stats.yeojohnson(X[var])
  
      return self
  
file_path: feature_engine/feature_engine/transformation/yeojohnson.py
imports: from typing import List, Optional, Union
  import pandas
  import scipy.stats
  from feature_engine._base_transformers.base_numerical import BaseNumericalTransformer
  from feature_engine._docstrings.fit_attributes import _feature_names_in_docstring, _n_features_in_docstring, _variables_attribute_docstring
  from feature_engine._docstrings.init_parameters import _variables_numerical_docstring
  from feature_engine._docstrings.methods import _fit_transform_docstring
  from feature_engine._docstrings.substitute import Substitution
  from feature_engine._variable_handling.init_parameter_checks import _check_init_parameter_variables
label_desc: Use image node_id 2 for calling the YeoJohnsonTransformer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self