code: def test_inverse_with_mapping(self):
      df = X.copy(deep=True)
      categoricals = [
          "unique_int",
          "unique_str",
          "invariant",
          "underscore",
          "none",
          "extra",
      ]
      mappings = {
          "as Series": [
              {
                  "col": c,
                  "mapping": pd.Series(
                      data=range(len(df[c].unique())),
                      index=df[c].unique(),
                  ),
                  "data_type": X[c].dtype,
              }
              for c in categoricals
          ],
          "as Dict": [
              {
                  "col": c,
                  "mapping": {
                      k: idx for idx, k in enumerate(df[c].unique())
                  },
              }
              for c in categoricals
          ],
      }
      for msg, mapping in mappings.items():
          with self.subTest(msg):
              df = X.copy(deep=True)
              enc = encoders.OrdinalEncoder(
                  cols=categoricals,
                  handle_unknown="ignore",
                  mapping=mapping,
                  return_df=True,
              )
              df[categoricals] = enc.fit_transform(df[categoricals])
              recovered = enc.inverse_transform(df[categoricals])
              pd.testing.assert_frame_equal(X[categoricals], recovered)
  
imports: import pandas
  from unittest import TestCase
  import tests.helpers
  import numpy
  import category_encoders
label_desc: Use image node_id 20 for calling the TestOrdinalEncoder obj's underlying member method code with example usage: obj.test_inverse_with_mapping() without return types