code: def count_categorizer(
      df: pd.DataFrame,
      columns_to_categorize: List[str],
      replace_unseen: int = -1,
      store_mapping: bool = False,
  ) -> LearnerReturnType:
      """
      Replaces categorical variables by count.
  
      The default behaviour is to replace the original values. To store
      the original values in a new column, specify `prefix` or `suffix`
      in the parameters, or specify a dictionary with the desired column
      mapping using the `columns_mapping` parameter.
  
      Parameters
      ----------
  
      df : pandas.DataFrame
          A Pandas' DataFrame that must contain `columns_to_categorize` columns.
  
      columns_to_categorize : list of str
          A list of categorical column names.
  
      replace_unseen : int
          The value to impute unseen categories.
  
      store_mapping : bool (default: False)
          Whether to store the feature value -> integer dictionary in the log
      """
  
      categ_getter = lambda col: df[col].value_counts().to_dict()
      vec = {
          column: categ_getter(column)
          for column in columns_to_categorize
      }
  
      def p(new_df: pd.DataFrame) -> pd.DataFrame:
          return apply_replacements(
              new_df, columns_to_categorize, vec, replace_unseen
          )
  
      p.__doc__ = learner_pred_fn_docstring("count_categorizer")
  
      log: LearnerLogType = {
          "count_categorizer": {
              "transformed_column": columns_to_categorize,
              "replace_unseen": replace_unseen,
          }
      }
  
      if store_mapping:
          log["count_categorizer"]["mapping"] = vec
  
      return p, p(df), log
  
imports: from typing import Any, Callable, Dict, List, Union, Optional
  import numpy
  import pandas
  from numpy import nan
  from sklearn.preprocessing import StandardScaler
  from statsmodels.distributions import empirical_distribution
  from toolz import curry, merge, compose, mapcat
  from fklearn.common_docstrings import learner_return_docstring, learner_pred_fn_docstring
  from fklearn.training.utils import log_learner_time
  from fklearn.types import LearnerReturnType, LearnerLogType
  from fklearn.preprocessing.schema import column_duplicatable
label_desc: Use image node_id 11 for calling a global function with example usage: count_categorizer(df, columns_to_categorize, replace_unseen, store_mapping) and returns: p,  p,  log, apply_replacements