class_docstr: Encodes categorical features as ordinal, in one ordered feature.
  
  Ordinal encoding uses a single column of integers to represent the classes. An optional mapping dict can be passed
  in; in this case, we use the knowledge that there is some true order to the classes themselves. Otherwise, the classes
  are assumed to have no true order and integers are selected at random.
  
  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.
  return_df: bool
      boolean for whether to return a pandas DataFrame from transform (otherwise it will be a numpy array).
  mapping: list of dicts
      a mapping of class to label to use for the encoding, optional.
      the dict contains the keys 'col' and 'mapping'.
      the value of 'col' should be the feature name.
      the value of 'mapping' should be a dictionary or pd.Series of 'original_label' to 'encoded_label'.
      example mapping: [
          {'col': 'col1', 'mapping': {None: 0, 'a': 1, 'b': 2}},
          {'col': 'col2', 'mapping': {None: 0, 'x': 1, 'y': 2}}
      ]
  handle_unknown: str
      options are 'error', 'return_nan' and 'value', defaults to 'value', which will impute the category -1.
  handle_missing: str
      options are 'error', 'return_nan', and 'value, default to 'value', which treat nan as a category at fit time,
      or -2 at transform time if nan is not a category during fit.
  
  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 = OrdinalEncoder(cols=['CentralAir', 'Heating']).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 7 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      1460 non-null   int64  
   6   CentralAir   1460 non-null   int64  
  dtypes: float64(4), int64(2), object(1)
  memory usage: 80.0+ KB
  None
  
  References
  ----------
  
  .. [1] Contrast Coding Systems for Categorical Variables, from
  https://stats.idre.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/
  
  .. [2] Gregory Carey (2003). Coding Categorical Variables, from
  http://ibgwww.colorado.edu/~carey/p5741ndir/Coding_Categorical_Variables.pdf
class_docstr_tok: ["Encodes","categorical","features","as","ordinal",",","in","one","ordered","feature",".","Ordinal","encoding","uses","a","single","column","of","integers","to","represent","the","classes",".","An","optional","mapping","dict","can","be","passed","in",";","in","this","case",",","we","use","the","knowledge","that","there","is","some","true","order","to","the","classes","themselves",".","Otherwise",",","the","classes","are","assumed","to","have","no","true","order","and","integers","are","selected","at","random",".","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",".","return_df",":","bool","boolean","for","whether","to","return","a","pandas","DataFrame","from","transform","(","otherwise","it","will","be","a","numpy","array",")",".","mapping",":","list","of","dicts","a","mapping","of","class","to","label","to","use","for","the","encoding",",","optional",".","the","dict","contains","the","keys","'col","'","and","'mapping","'",".","the","value","of","'col","'","should","be","the","feature","name",".","the","value","of","'mapping","'","should","be","a","dictionary","or","pd.Series","of","'original_label","'","to","'encoded_label","'",".","example","mapping",":","[","{","'col","'",":","'col1","'",",","'mapping","'",":","{","None",":","0",",","'","a","'",":","1",",","'","b","'",":","2","}","}",",","{","'col","'",":","'col2","'",",","'mapping","'",":","{","None",":","0",",","'","x","'",":","1",",","'","y","'",":","2","}","}","]","handle_unknown",":","str","options","are","'error","'",",","'return_nan","'","and","'value","'",",","defaults","to","'value","'",",","which","will","impute","the","category","-1.","handle_missing",":","str","options","are","'error","'",",","'return_nan","'",",","and","'value",",","default","to","'value","'",",","which","treat","nan","as","a","category","at","fit","time",",","or","-2","at","transform","time","if","nan","is","not","a","category","during","fit",".","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","=","OrdinalEncoder","(","cols=","[","'CentralAir","'",",","'Heating","'","]",")",".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","7","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","1460","non-null","int64","6","CentralAir","1460","non-null","int64","dtypes",":","float64","(","4",")",",","int64","(","2",")",",","object","(","1",")","memory","usage",":","80.0+","KB","None","References","--","--","--","--","--","..","[","1","]","Contrast","Coding","Systems","for","Categorical","Variables",",","from","https",":","\/\/stats.idre.ucla.edu\/r\/library\/r-library-contrast-coding-systems-for-categorical-variables\/","..","[","2","]","Gregory","Carey","(","2003",")",".","Coding","Categorical","Variables",",","from","http",":","\/\/ibgwww.colorado.edu\/~carey\/p5741ndir\/Coding_Categorical_Variables.pdf"]
code: def category_mapping(self):
      return self.mapping
  
file_path: category_encoders/category_encoders/ordinal.py
imports: import numpy
  import pandas
  import category_encoders.utils
  import warnings
  from typing import Dict, List, Union
label_desc: Use image node_id 2 for calling the OrdinalEncoder obj's underlying member method code with example usage: obj.category_mapping() and returns: self