class_docstr: The EndTailImputer() replaces missing data by a value at either tail of the
  distribution. It works only with numerical variables.
  
  You can indicate the variables to impute in a list. Alternatively, the
  EndTailImputer() will automatically select all numerical variables.
  
  The imputer first calculates the values at the end of the distribution for each
  variable (fit). The values at the end of the distribution are determined using
  the Gaussian limits, the the IQR proximity rule limits, or a factor of the maximum
  value:
  
  Gaussian limits:
      - right tail: mean + 3*std
      - left tail: mean - 3*std
  
  IQR limits:
      - right tail: 75th quantile + 3*IQR
      - left tail:  25th quantile - 3*IQR
  
  where IQR is the inter-quartile range = 75th quantile - 25th quantile
  
  Maximum value:
      - right tail: max * 3
      - left tail: not applicable
  
  You can change the factor that multiplies the std, IQR or the maximum value
  using the parameter `fold` (we used `fold=3` in the examples above).
  
  The imputer then replaces the missing data with the estimated values (transform).
  
  More details in the :ref:`User Guide <end_tail_imputer>`.
  
  Parameters
  ----------
  imputation_method: str, default='gaussian'
      Method to be used to find the replacement values. Can take 'gaussian',
      'iqr' or 'max'.
  
      **'gaussian'**: the imputer will use the Gaussian limits to find the values
      to replace missing data.
  
      **'iqr'**: the imputer will use the IQR limits to find the values to replace
      missing data.
  
      **'max'**: the imputer will use the maximum values to replace missing data. Note
      that if 'max' is passed, the parameter 'tail' is ignored.
  
  tail: str, default='right'
      Indicates if the values to replace missing data should be selected from the
      right or left tail of the variable distribution. Can take values 'left' or
      'right'.
  
  fold: int, default=3
      Factor to multiply the std, the IQR or the Max values. Recommended values
      are 2 or 3 for Gaussian, or 1.5 or 3 for IQR.
  
  {variables}
  
  Attributes
  ----------
  {imputer_dict_}
  
  {variables_}
  
  {feature_names_in_}
  
  {n_features_in_}
  
  Methods
  -------
  fit:
      Learn values to replace missing data.
  
  {fit_transform}
  
  {transform}
  
  Examples
  --------
  
  >>> import pandas as pd
  >>> import numpy as np
  >>> from feature_engine.imputation import EndTailImputer
  >>> X = pd.DataFrame(dict(x1 = [np.nan,0.5, 0.5, 0,np.nan]))
  >>> eti = EndTailImputer(imputation_method='gaussian', tail='right', fold=3)
  >>> eti.fit(X)
  >>> eti.transform(X)
           x1
  0  1.199359
  1  0.500000
  2  0.500000
  3  0.000000
  4  1.199359
class_docstr_tok: ["The","EndTailImputer","(",")","replaces","missing","data","by","a","value","at","either","tail","of","the","distribution",".","It","works","only","with","numerical","variables",".","You","can","indicate","the","variables","to","impute","in","a","list",".","Alternatively",",","the","EndTailImputer","(",")","will","automatically","select","all","numerical","variables",".","The","imputer","first","calculates","the","values","at","the","end","of","the","distribution","for","each","variable","(","fit",")",".","The","values","at","the","end","of","the","distribution","are","determined","using","the","Gaussian","limits",",","the","the","IQR","proximity","rule","limits",",","or","a","factor","of","the","maximum","value",":","Gaussian","limits",":","-","right","tail",":","mean","+","3","*","std","-","left","tail",":","mean","-","3","*","std","IQR","limits",":","-","right","tail",":","75th","quantile","+","3","*","IQR","-","left","tail",":","25th","quantile","-","3","*","IQR","where","IQR","is","the","inter-quartile","range","=","75th","quantile","-","25th","quantile","Maximum","value",":","-","right","tail",":","max","*","3","-","left","tail",":","not","applicable","You","can","change","the","factor","that","multiplies","the","std",",","IQR","or","the","maximum","value","using","the","parameter","`","fold","`","(","we","used","`","fold=3","`","in","the","examples","above",")",".","The","imputer","then","replaces","the","missing","data","with","the","estimated","values","(","transform",")",".","More","details","in","the",":","ref",":","`","User","Guide","<","end_tail_imputer",">","`",".","Parameters","--","--","--","--","--","imputation_method",":","str",",","default='gaussian'","Method","to","be","used","to","find","the","replacement","values",".","Can","take","'gaussian","'",",","'iqr","'","or","'max","'",".","*","*","'gaussian","'","*","*",":","the","imputer","will","use","the","Gaussian","limits","to","find","the","values","to","replace","missing","data",".","*","*","'iqr","'","*","*",":","the","imputer","will","use","the","IQR","limits","to","find","the","values","to","replace","missing","data",".","*","*","'max","'","*","*",":","the","imputer","will","use","the","maximum","values","to","replace","missing","data",".","Note","that","if","'max","'","is","passed",",","the","parameter","'tail","'","is","ignored",".","tail",":","str",",","default='right'","Indicates","if","the","values","to","replace","missing","data","should","be","selected","from","the","right","or","left","tail","of","the","variable","distribution",".","Can","take","values","'left","'","or","'right","'",".","fold",":","int",",","default=3","Factor","to","multiply","the","std",",","the","IQR","or","the","Max","values",".","Recommended","values","are","2","or","3","for","Gaussian",",","or","1.5","or","3","for","IQR",".","{","variables","}","Attributes","--","--","--","--","--","{","imputer_dict_","}","{","variables_","}","{","feature_names_in_","}","{","n_features_in_","}","Methods","--","--","--","-","fit",":","Learn","values","to","replace","missing","data",".","{","fit_transform","}","{","transform","}","Examples","--","--","--","--",">",">",">","import","pandas","as","pd",">",">",">","import","numpy","as","np",">",">",">","from","feature_engine.imputation","import","EndTailImputer",">",">",">","X","=","pd.DataFrame","(","dict","(","x1","=","[","np.nan,0.5",",","0.5",",","0",",","np.nan","]",")",")",">",">",">","eti","=","EndTailImputer","(","imputation_method='gaussian","'",",","tail='right","'",",","fold=3",")",">",">",">","eti.fit","(","X",")",">",">",">","eti.transform","(","X",")","x1","0","1.199359","1","0.500000","2","0.500000","3","0.000000","4","1.199359"]
code: def __init__(
      self,
      imputation_method: str = "gaussian",
      tail: str = "right",
      fold: int = 3,
      variables: Union[None, int, str, List[Union[str, int]]] = None,
  ) -> None:
      if imputation_method not in ["gaussian", "iqr", "max"]:
          raise ValueError(
              "imputation_method takes only values 'gaussian', 'iqr' or 'max'"
          )
  
      if tail not in ["right", "left"]:
          raise ValueError("tail takes only values 'right' or 'left'")
  
      if fold <= 0:
          raise ValueError("fold takes only positive numbers")
  
      self.imputation_method = imputation_method
      self.tail = tail
      self.fold = fold
      self.variables = _check_init_parameter_variables(variables)
  
file_path: feature_engine/feature_engine/imputation/end_tail.py
imports: from typing import List, Optional, Union
  import pandas
  from feature_engine._docstrings.fit_attributes import _feature_names_in_docstring, _n_features_in_docstring, _variables_attribute_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
  from feature_engine._variable_handling.variable_type_selection import _find_or_check_numerical_variables
  from feature_engine.dataframe_checks import check_X
  from feature_engine.imputation.base_imputer import BaseImputer
label_desc: Use image node_id 1 to create a new EndTailImputer object from inherited base classes: BaseImputer with example: obj = EndTailImputer(imputation_method, tail, fold, variables)