class_docstr: The BoxCoxTransformer() applies the BoxCox transformation to numerical
  variables.
  
  The Box-Cox transformation is defined as:
  
  - T(Y)=(Y exp(λ)−1)/λ if λ!=0
  - log(Y) otherwise
  
  where Y is the response variable and λ is the transformation parameter. λ varies,
  typically from -5 to 5. In the transformation, all values of λ are considered and
  the optimal value for a given variable is selected.
  
  The BoxCox transformation implemented by this transformer is that of
  SciPy.stats:
  https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.boxcox.html
  
  The BoxCoxTransformer() works only with numerical positive variables (>=0).
  
  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 <box_cox>`.
  
  Parameters
  ----------
  {variables}
  
  Attributes
  ----------
  lambda_dict_:
      Dictionary with the best BoxCox exponent per variable.
  
  {variables_}
  
  {feature_names_in_}
  
  {n_features_in_}
  
  Methods
  -------
  fit:
      Learn the optimal lambda for the BoxCox transformation.
  
  {fit_transform}
  
  {inverse_transform}
  
  transform:
      Apply the BoxCox transformation.
  
  References
  ----------
  .. [1] Box and Cox. "An Analysis of Transformations". Read at a RESEARCH MEETING,
      1964.
      https://rss.onlinelibrary.wiley.com/doi/abs/10.1111/j.2517-6161.1964.tb00553.x
class_docstr_tok: ["The","BoxCoxTransformer","(",")","applies","the","BoxCox","transformation","to","numerical","variables",".","The","Box-Cox","transformation","is","defined","as",":","-","T","(","Y",")","=","(","Y","exp","(","\u03bb",")","\u22121",")","\/\u03bb","if","\u03bb","!","=0","-","log","(","Y",")","otherwise","where","Y","is","the","response","variable","and","\u03bb","is","the","transformation","parameter",".","\u03bb","varies",",","typically","from","-5","to","5",".","In","the","transformation",",","all","values","of","\u03bb","are","considered","and","the","optimal","value","for","a","given","variable","is","selected",".","The","BoxCox","transformation","implemented","by","this","transformer","is","that","of","SciPy.stats",":","https",":","\/\/docs.scipy.org\/doc\/scipy\/reference\/generated\/scipy.stats.boxcox.html","The","BoxCoxTransformer","(",")","works","only","with","numerical","positive","variables","(",">","=0",")",".","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","<","box_cox",">","`",".","Parameters","--","--","--","--","--","{","variables","}","Attributes","--","--","--","--","--","lambda_dict_",":","Dictionary","with","the","best","BoxCox","exponent","per","variable",".","{","variables_","}","{","feature_names_in_","}","{","n_features_in_","}","Methods","--","--","--","-","fit",":","Learn","the","optimal","lambda","for","the","BoxCox","transformation",".","{","fit_transform","}","{","inverse_transform","}","transform",":","Apply","the","BoxCox","transformation",".","References","--","--","--","--","--","..","[","1","]","Box","and","Cox",".","``","An","Analysis","of","Transformations","''",".","Read","at","a","RESEARCH","MEETING",",","1964.","https",":","\/\/rss.onlinelibrary.wiley.com\/doi\/abs\/10.1111\/j.2517-6161.1964.tb00553.x"]
docstr: Learn the optimal lambda for the BoxCox 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","BoxCox","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 BoxCox 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.boxcox(X[var])
  
      return self
  
file_path: feature_engine/feature_engine/transformation/boxcox.py
imports: from typing import List, Optional, Union
  import pandas
  import scipy.stats
  from scipy.special import inv_boxcox
  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, _inverse_transform_docstring
  from feature_engine._docstrings.substitute import Substitution
  from feature_engine._variable_handling.init_parameter_checks import _check_init_parameter_variables
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 2 for calling the BoxCoxTransformer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self