class_docstr: ################################################################################################
  ######           The My_LabelEncoder class was developed by Ram Seshadri for AutoViML  #########
  ######     The My_LabelEncoder class works just like sklearn's Label Encoder but better! #######
  #####  It label encodes any cat var in your dataset. It also handles NaN's in your dataset! ####
  ##  The beauty of this function is that it takes care of NaN's and unknown (future) values.#####
  ##################### This is the BEST working version - don't mess with it!! ##################
  ################################################################################################
  Usage:
        le = My_LabelEncoder()
        le.fit_transform(train[column]) ## this will give your transformed values as an array
        le.transform(test[column]) ### this will give your transformed values as an array
            
  Usage in Column Transformers and Pipelines:
        No. It cannot be used in pipelines since it need to produce two columns for the next stage in pipeline.
        See my other module called My_LabelEncoder_Pipe() to see how it can be used in Pipelines.
class_docstr_tok: ["#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","The","My_LabelEncoder","class","was","developed","by","Ram","Seshadri","for","AutoViML","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","The","My_LabelEncoder","class","works","just","like","sklearn","'s","Label","Encoder","but","better","!","#","#","#","#","#","#","#","#","#","#","#","#","It","label","encodes","any","cat","var","in","your","dataset",".","It","also","handles","NaN","'s","in","your","dataset","!","#","#","#","#","#","#","The","beauty","of","this","function","is","that","it","takes","care","of","NaN","'s","and","unknown","(","future",")","values.","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","This","is","the","BEST","working","version","-","do","n't","mess","with","it","!","!","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","Usage",":","le","=","My_LabelEncoder","(",")","le.fit_transform","(","train","[","column","]",")","#","#","this","will","give","your","transformed","values","as","an","array","le.transform","(","test","[","column","]",")","#","#","#","this","will","give","your","transformed","values","as","an","array","Usage","in","Column","Transformers","and","Pipelines",":","No",".","It","can","not","be","used","in","pipelines","since","it","need","to","produce","two","columns","for","the","next","stage","in","pipeline",".","See","my","other","module","called","My_LabelEncoder_Pipe","(",")","to","see","how","it","can","be","used","in","Pipelines","."]
code: def fit(self, testx, y=None):
      if isinstance(testx, pd.Series):
          pass
      elif isinstance(testx, np.ndarray):
          testx = pd.Series(testx)
      else:
          #### There is no way to transform dataframes since you will get a nested renamer error if you try ###
          ### But if it is a one-dimensional dataframe, convert it into a Series
          if testx.shape[1] == 1:
              testx = pd.Series(
                  testx.values.ravel(), name=testx.columns[0]
              )
          else:
              #### Since it is multi-dimensional, So in this case, just return the data as is
              return self
      ins = np.unique(testx.factorize()[1]).tolist()
      outs = np.unique(testx.factorize()[0]).tolist()
      # ins = testx.value_counts(dropna=False).index
      if -1 in outs:
          #   it already has nan if -1 is in outs. No need to add it.
          if not np.nan in ins:
              ins.insert(0, np.nan)
      self.transformer = dict(zip(ins, outs))
      self.inverse_transformer = dict(zip(outs, ins))
      return self
  
imports: import numpy
  import pandas
  from sklearn.impute import SimpleImputer
  from sklearn.preprocessing import OneHotEncoder
  from sklearn.feature_extraction.text import CountVectorizer
  from sklearn.linear_model import LogisticRegression
  from sklearn.compose import make_column_transformer
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import LabelEncoder, LabelBinarizer
  from sklearn.base import BaseEstimator, TransformerMixin
  import pdb
  from sklearn.base import TransformerMixin
  from collections import defaultdict
label_desc: Use image node_id 2 for calling the My_LabelEncoder obj's underlying member method code with example usage: obj.fit(testx, y) and returns: self, self