code: def test_count_categorizer():
      input_df_train = pd.DataFrame(
          {
              "feat1_num": [1, 0.5, nan, 100],
              "feat2_cat": ["a", "a", "a", "b"],
              "feat3_cat": ["c", "c", "c", nan],
          }
      )
  
      expected_output_train = pd.DataFrame(
          {
              "feat1_num": [1, 0.5, nan, 100],
              "feat2_cat": [3, 3, 3, 1],
              "feat3_cat": [3, 3, 3, nan],
          }
      )
  
      input_df_test = pd.DataFrame(
          {
              "feat1_num": [2, 20, 200, 2000],
              "feat2_cat": ["a", "b", "b", "d"],
              "feat3_cat": [nan, nan, "c", "c"],
          }
      )
  
      expected_output_test = pd.DataFrame(
          {
              "feat1_num": [2, 20, 200, 2000],
              "feat2_cat": [
                  3,
                  1,
                  1,
                  1,
              ],  # replace unseen vars with constant (1)
              "feat3_cat": [nan, nan, 3, 3],
          }
      )
  
      categorizer_learner1 = count_categorizer(
          columns_to_categorize=["feat2_cat", "feat3_cat"],
          replace_unseen=1,
      )
      categorizer_learner2 = count_categorizer(
          columns_to_categorize=["feat2_cat", "feat3_cat"],
          replace_unseen=1,
          suffix="_suffix",
      )
      categorizer_learner3 = count_categorizer(
          columns_to_categorize=["feat2_cat", "feat3_cat"],
          replace_unseen=1,
          prefix="prefix_",
      )
      categorizer_learner4 = count_categorizer(
          columns_to_categorize=["feat2_cat", "feat3_cat"],
          replace_unseen=1,
          columns_mapping={
              "feat2_cat": "feat2_cat_raw",
              "feat3_cat": "feat3_cat_raw",
          },
      )
  
      pred_fn1, data1, log = categorizer_learner1(input_df_train)
      pred_fn2, data2, log = categorizer_learner2(input_df_train)
      pred_fn3, data3, log = categorizer_learner3(input_df_train)
      pred_fn4, data4, log = categorizer_learner4(input_df_train)
  
      assert expected_output_train.equals(data1)
      assert expected_output_test.equals(pred_fn1(input_df_test))
  
      categorized = ["feat2_cat", "feat3_cat"]
      assert pd.concat(
          [
              expected_output_train,
              input_df_train[categorized].copy().add_suffix("_suffix"),
          ],
          axis=1,
      ).equals(data2)
      assert pd.concat(
          [
              expected_output_test,
              input_df_test[categorized].copy().add_suffix("_suffix"),
          ],
          axis=1,
      ).equals(pred_fn2(input_df_test))
  
      assert pd.concat(
          [
              expected_output_train,
              input_df_train[categorized].copy().add_prefix("prefix_"),
          ],
          axis=1,
      ).equals(data3)
      assert pd.concat(
          [
              expected_output_test,
              input_df_test[categorized].copy().add_prefix("prefix_"),
          ],
          axis=1,
      ).equals(pred_fn3(input_df_test))
  
      assert pd.concat(
          [
              expected_output_train,
              input_df_train[categorized].copy().add_suffix("_raw"),
          ],
          axis=1,
      ).equals(data4)
      assert pd.concat(
          [
              expected_output_test,
              input_df_test[categorized].copy().add_suffix("_raw"),
          ],
          axis=1,
      ).equals(pred_fn4(input_df_test))
  
imports: from collections import OrderedDict
  import math
  import pandas
  import pytest
  from numpy import nan, round, sqrt, floor, log
  from numpy.testing import assert_almost_equal
  from pandas.testing import assert_frame_equal
  from fklearn.training.transformation import selector, capper, floorer, prediction_ranger, count_categorizer, label_categorizer, quantile_biner, truncate_categorical, rank_categorical, onehot_categorizer, target_categorizer, standard_scaler, ecdfer, discrete_ecdfer, custom_transformer, value_mapper, null_injector, missing_warner
label_desc: Use image node_id 8 for calling a global function with example usage: test_count_categorizer() without return types