code: def test_zero_encoding_for_unseen_categories_if_unseen_is_encode():
      df_fit = pd.DataFrame(
          {
              "col1": ["a", "a", "b", "a", "c"],
              "col2": ["1", "2", "3", "1", "2"],
          }
      )
      df_transform = pd.DataFrame(
          {
              "col1": ["a", "d", "b", "a", "c"],
              "col2": ["1", "2", "3", "1", "4"],
          }
      )
  
      # count encoding
      encoder = CountFrequencyEncoder(unseen="encode").fit(df_fit)
      result = encoder.transform(df_transform)
  
      # check that no NaNs are added
      assert pd.isnull(result).sum().sum() == 0
  
      # check that the counts are correct
      expected_result = pd.DataFrame(
          {"col1": [3, 0, 1, 3, 1], "col2": [2, 2, 1, 2, 0]}
      )
      pd.testing.assert_frame_equal(result, expected_result)
  
      # with frequency
      encoder = CountFrequencyEncoder(
          encoding_method="frequency", unseen="encode"
      ).fit(df_fit)
      result = encoder.transform(df_transform)
  
      # check that no NaNs are added
      assert pd.isnull(result).sum().sum() == 0
  
      # check that the frequencies are correct
      expected_result = pd.DataFrame(
          {
              "col1": [0.6, 0, 0.2, 0.6, 0.2],
              "col2": [0.4, 0.4, 0.2, 0.4, 0],
          }
      )
      pd.testing.assert_frame_equal(result, expected_result)
  
imports: import warnings
  import numpy
  import pandas
  import pytest
  from numpy import nan
  from feature_engine.encoding import CountFrequencyEncoder
label_desc: Use image node_id 10 for calling a global function with example usage: test_zero_encoding_for_unseen_categories_if_unseen_is_encode() without return types