code: def test_custom_mapping(self):
      # See issue 193
      custom_mapping = [
          {
              "col": "col1",
              "mapping": {np.NaN: 0, "a": 1, "b": 2},
          },  # The mapping from the documentation
          {"col": "col2", "mapping": {np.NaN: -3, "x": 11, "y": 2}},
      ]
      custom_mapping_series = [
          {
              "col": "col1",
              "mapping": pd.Series({np.NaN: 0, "a": 1, "b": 2}),
          },  # The mapping from the documentation
          {
              "col": "col2",
              "mapping": pd.Series({np.NaN: -3, "x": 11, "y": 2}),
          },
      ]
  
      train = pd.DataFrame(
          {
              "col1": ["a", "a", "b", np.NaN],
              "col2": ["x", "y", np.NaN, np.NaN],
          }
      )
  
      for mapping in [custom_mapping, custom_mapping_series]:
          with self.subTest():
              enc = encoders.OrdinalEncoder(
                  handle_missing="value", mapping=mapping
              )
              out = enc.fit_transform(
                  train
              )  # We have to first 'fit' before 'transform' even if we do nothing during the fit...
  
              self.assertListEqual([1, 1, 2, 0], out["col1"].tolist())
              self.assertListEqual(
                  [11, 2, -3, -3], out["col2"].tolist()
              )
  
imports: import pandas
  from unittest import TestCase
  import tests.helpers
  import numpy
  import category_encoders
label_desc: Use image node_id 8 for calling the TestOrdinalEncoder obj's underlying member method code with example usage: obj.test_custom_mapping() without return types