class_docstr: The rank-hot encoder is similar to a one-hot encoder,
  except every feature up to and including the current rank is hot.
  This is also called thermometer encoding.
  
  Parameters
  ----------
  
  verbose: int
      integer indicating verbosity of the output. 0 for none.
  cols: list
      a list of columns to encode, if None, all string columns will be encoded.
  drop_invariant: bool
      boolean for whether or not to drop columns with 0 variance.
  use_cat_names: bool
      if True, category values will be included in the encoded column names.
         Since this can result in duplicate column names,
         duplicates are suffixed with '#' symbol until a unique name is generated.
      If False, category indices will be used instead of the category values.
  handle_unknown: str
      options are 'error', 'value', 'return_nan'.
      The default is 'value'.
      'value': If an unknown label occurrs, it is represented as 0 array.
      'error': If an unknown label occurrs, error message is displayed.
      'return_nan': If an unknown label occurrs, np.nan is returned in all columns.
  handle_missing: str
      options are 'error', 'value' and 'return_nan'. The default is 'value'.
      Missing value also considered as unknown value in the final data set.
  
  Example
  -------
   >>> from category_encoders import *
   >>> import pandas as pd
   >>> from sklearn.datasets import fetch_openml
   >>> bunch = fetch_openml(name="house_prices", as_frame=True)
   >>> display_cols = ["Id", "MSSubClass", "MSZoning", "LotFrontage", "YearBuilt", "Heating", "CentralAir"]
   >>> y = bunch.target
   >>> X = pd.DataFrame(bunch.data, columns=bunch.feature_names)[display_cols]
   >>> enc = RankHotEncoder(cols=['CentralAir', 'Heating'], handle_unknown='indicator').fit(X, y)
   >>> numeric_dataset = enc.transform(X)
   >>> print(numeric_dataset.info())
   <class 'pandas.core.frame.DataFrame'>
   RangeIndex: 1460 entries, 0 to 1459
   Data columns (total 13 columns):
    #   Column        Non-Null Count  Dtype  
   ---  ------        --------------  -----  
    0   Id            1460 non-null   float64
    1   MSSubClass    1460 non-null   float64
    2   MSZoning      1460 non-null   object 
    3   LotFrontage   1201 non-null   float64
    4   YearBuilt     1460 non-null   float64
    5   Heating_1     1460 non-null   int64  
    6   Heating_2     1460 non-null   int64  
    7   Heating_3     1460 non-null   int64  
    8   Heating_4     1460 non-null   int64  
    9   Heating_5     1460 non-null   int64  
    10  Heating_6     1460 non-null   int64  
    11  CentralAir_1  1460 non-null   int64  
    12  CentralAir_2  1460 non-null   int64  
   dtypes: float64(4), int64(8), object(1)
   memory usage: 148.4+ KB
   None
class_docstr_tok: ["The","rank-hot","encoder","is","similar","to","a","one-hot","encoder",",","except","every","feature","up","to","and","including","the","current","rank","is","hot",".","This","is","also","called","thermometer","encoding",".","Parameters","--","--","--","--","--","verbose",":","int","integer","indicating","verbosity","of","the","output",".","0","for","none",".","cols",":","list","a","list","of","columns","to","encode",",","if","None",",","all","string","columns","will","be","encoded",".","drop_invariant",":","bool","boolean","for","whether","or","not","to","drop","columns","with","0","variance",".","use_cat_names",":","bool","if","True",",","category","values","will","be","included","in","the","encoded","column","names",".","Since","this","can","result","in","duplicate","column","names",",","duplicates","are","suffixed","with","'","#","'","symbol","until","a","unique","name","is","generated",".","If","False",",","category","indices","will","be","used","instead","of","the","category","values",".","handle_unknown",":","str","options","are","'error","'",",","'value","'",",","'return_nan","'",".","The","default","is","'value","'",".","'value","'",":","If","an","unknown","label","occurrs",",","it","is","represented","as","0","array",".","'error","'",":","If","an","unknown","label","occurrs",",","error","message","is","displayed",".","'return_nan","'",":","If","an","unknown","label","occurrs",",","np.nan","is","returned","in","all","columns",".","handle_missing",":","str","options","are","'error","'",",","'value","'","and","'return_nan","'",".","The","default","is","'value","'",".","Missing","value","also","considered","as","unknown","value","in","the","final","data","set",".","Example","--","--","--","-",">",">",">","from","category_encoders","import","*",">",">",">","import","pandas","as","pd",">",">",">","from","sklearn.datasets","import","fetch_openml",">",">",">","bunch","=","fetch_openml","(","name=","''","house_prices","''",",","as_frame=True",")",">",">",">","display_cols","=","[","``","Id","''",",","``","MSSubClass","''",",","``","MSZoning","''",",","``","LotFrontage","''",",","``","YearBuilt","''",",","``","Heating","''",",","``","CentralAir","''","]",">",">",">","y","=","bunch.target",">",">",">","X","=","pd.DataFrame","(","bunch.data",",","columns=bunch.feature_names",")","[","display_cols","]",">",">",">","enc","=","RankHotEncoder","(","cols=","[","'CentralAir","'",",","'Heating","'","]",",","handle_unknown='indicator","'",")",".fit","(","X",",","y",")",">",">",">","numeric_dataset","=","enc.transform","(","X",")",">",">",">","print","(","numeric_dataset.info","(",")",")","<","class","'pandas.core.frame.DataFrame","'",">","RangeIndex",":","1460","entries",",","0","to","1459","Data","columns","(","total","13","columns",")",":","#","Column","Non-Null","Count","Dtype","--","-","--","--","--","--","--","--","--","--","--","--","--","--","-","0","Id","1460","non-null","float64","1","MSSubClass","1460","non-null","float64","2","MSZoning","1460","non-null","object","3","LotFrontage","1201","non-null","float64","4","YearBuilt","1460","non-null","float64","5","Heating_1","1460","non-null","int64","6","Heating_2","1460","non-null","int64","7","Heating_3","1460","non-null","int64","8","Heating_4","1460","non-null","int64","9","Heating_5","1460","non-null","int64","10","Heating_6","1460","non-null","int64","11","CentralAir_1","1460","non-null","int64","12","CentralAir_2","1460","non-null","int64","dtypes",":","float64","(","4",")",",","int64","(","8",")",",","object","(","1",")","memory","usage",":","148.4+","KB","None"]
code: def _fit(self, X, y, **kwargs):
      oe_missing_strat = {
          "error": "error",
          "return_nan": "return_nan",
          "value": "value",
          "indicator": "return_nan",
      }[self.handle_missing]
      # supply custom mapping in order to assure order of ordinal variable
      ordered_mapping = []
      for col in self.cols:
          oe_col = OrdinalEncoder(
              verbose=self.verbose,
              cols=[col],
              handle_unknown="value",
              handle_missing=oe_missing_strat,
          )
          oe_col.fit(X[col].sort_values().to_frame(name=col))
          ordered_mapping += oe_col.mapping
  
      self.ordinal_encoder = OrdinalEncoder(
          verbose=self.verbose,
          cols=self.cols,
          handle_unknown="value",
          handle_missing=oe_missing_strat,
          mapping=ordered_mapping,
      )
      self.ordinal_encoder = self.ordinal_encoder.fit(X)
  
      self.mapping = self.generate_mapping()
  
      return self
  
file_path: category_encoders/category_encoders/rankhot.py
imports: import numpy
  import pandas
  from category_encoders import OrdinalEncoder
  import category_encoders.utils
label_desc: Use image node_id 2 for calling the RankHotEncoder obj's underlying member method code with example usage: obj._fit(X, y) and returns: self