class_docstr: FrequencyEncoder
  Conversion of category into frequencies.
  Parameters
      ----------
  cols : list of categorical features.
  drop_invariant : not used
docstr: Description of transform
  
  Args:
      X (pd.DataFrame): dataset
  
  Returns:
      pd.DataFrame
docstr_tok: ["Description","of","transform","Args",":","X","(","pd.DataFrame",")",":","dataset","Returns",":","pd.DataFrame"]
code: def transform(self, X: pd.DataFrame) -> pd.DataFrame:
      """
      Description of transform
  
      Args:
          X (pd.DataFrame): dataset
  
      Returns:
          pd.DataFrame
  
      """
      counts_dict_test = {}
      res = []
      for col in self.cols:
          values = X[col].value_counts(1, dropna=False).index.tolist()
          counts = X[col].value_counts(1, dropna=False).values.tolist()
          counts_dict_test[col] = dict(zip(values, counts))
  
          # if value is in "train" keys - replace "test" counts with "train" counts
          for k in [
              key
              for key in counts_dict_test[col].keys()
              if key in self.counts_dict[col].keys()
          ]:
              counts_dict_test[col][k] = self.counts_dict[col][k]
          res.append(
              X[col].map(counts_dict_test[col]).values.reshape(-1, 1)
          )
      try:
          res = np.hstack(res)
      except:
          pdb.set_trace()
      X[self.cols] = res
      return X
  
imports: import pandas
  import numpy
label_desc: Use image node_id 3 for calling the FrequencyEncoder obj's underlying member method code with example usage: obj.transform(X) and returns: X