class_docstr: Encodes rare categories into an "other" parameter.
  
  Note that this encoder assumes data is received as a DataFrame.
  
  Parameters
  ----------
  max_num_categories : int , default: 10
      Indicates the maximum number of unique categories in a single categorical column
      (rare categories will be changed to a form of "other")
  cols : Optional[List[Hashable]] , default: None
      Columns to limit the encoder to work on. If non are given will work on all columns given in `fit`
class_docstr_tok: ["Encodes","rare","categories","into","an","``","other","''","parameter",".","Note","that","this","encoder","assumes","data","is","received","as","a","DataFrame",".","Parameters","--","--","--","--","--","max_num_categories",":","int",",","default",":","10","Indicates","the","maximum","number","of","unique","categories","in","a","single","categorical","column","(","rare","categories","will","be","changed","to","a","form","of","``","other","''",")","cols",":","Optional","[","List","[","Hashable","]","]",",","default",":","None","Columns","to","limit","the","encoder","to","work","on",".","If","non","are","given","will","work","on","all","columns","given","in","`","fit","`"]
docstr: Transform given data according to columns processed in `fit`.
  
  Parameters
  ----------
  data : pd.DataFrame
      data to transform
  Returns
  -------
  DataFrame
      transformed data
docstr_tok: ["Transform","given","data","according","to","columns","processed","in","`","fit","`",".","Parameters","--","--","--","--","--","data",":","pd.DataFrame","data","to","transform","Returns","--","--","--","-","DataFrame","transformed","data"]
code: def transform(self, data: pd.DataFrame):
      """Transform given data according to columns processed in `fit`.
  
      Parameters
      ----------
      data : pd.DataFrame
          data to transform
      Returns
      -------
      DataFrame
          transformed data
      """
      if self._col_mapping is None:
          raise RuntimeError("Cannot transform without fitting first")
  
      if self.cols is not None:
          data = data.copy()
          data[self.cols] = data[self.cols].apply(
              lambda s: s.map(self._col_mapping[s.name])
          )
      else:
          data = data.apply(lambda s: s.map(self._col_mapping[s.name]))
  
      return data
  
file_path: deepchecks/deepchecks/utils/distribution/rare_category_encoder.py
imports: from collections import defaultdict
  from typing import List, Optional
  import pandas
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 3 for calling the RareCategoryEncoder obj's underlying member method code with example usage: obj.transform(data) and returns: data