docstr: Unit test for apply_preprocessing on list of a dict, a list of dict and a ColumnTransformer.
docstr_tok: ["Unit","test","for","apply_preprocessing","on","list","of","a","dict",",","a","list","of","dict","and","a","ColumnTransformer","."]
code: def test_transform_ct_4(self):
      """
      Unit test for apply_preprocessing on list of a dict, a list of dict and a ColumnTransformer.
      """
      train = pd.DataFrame(
          {
              "city": ["CH", "CH", "PR"],
              "state": ["US-FR", "US-FR", "US-FR"],
              "other": ["A-B", "A-B", "C"],
          },
          index=["index1", "index2", "index3"],
      )
  
      y = pd.DataFrame(
          data=[0, 1, 0],
          columns=["y"],
          index=["index1", "index2", "index3"],
      )
  
      train_preprocessed = train.copy()
      input_dict1 = dict()
      input_dict1["col"] = "city"
      input_dict1["mapping"] = pd.Series(
          data=["chicago", "paris"], index=["CH", "PR"]
      )
      input_dict1["data_type"] = "object"
  
      transform_input_1 = pd.Series(
          data=input_dict1.get("mapping").values,
          index=input_dict1.get("mapping").index,
      )
      train_preprocessed[input_dict1.get("col")] = (
          train_preprocessed[input_dict1.get("col")]
          .map(transform_input_1)
          .astype(input_dict1.get("mapping").values.dtype)
      )
  
      input_dict2 = dict()
      input_dict2["col"] = "other"
      input_dict2["mapping"] = pd.Series(
          data=["A", "C"], index=["A-B", "C"]
      )
      input_dict2["data_type"] = "object"
  
      transform_input_2 = pd.Series(
          data=input_dict2.get("mapping").values,
          index=input_dict2.get("mapping").index,
      )
      train_preprocessed[input_dict2.get("col")] = (
          train_preprocessed[input_dict2.get("col")]
          .map(transform_input_2)
          .astype(input_dict2.get("mapping").values.dtype)
      )
  
      input_dict3 = dict()
      input_dict3["col"] = "state"
      input_dict3["mapping"] = pd.Series(
          data=["US FR"], index=["US-FR"]
      )
      input_dict3["data_type"] = "object"
  
      transform_input_3 = pd.Series(
          data=input_dict3.get("mapping").values,
          index=input_dict3.get("mapping").index,
      )
      train_preprocessed[input_dict3.get("col")] = (
          train_preprocessed[input_dict3.get("col")]
          .map(transform_input_3)
          .astype(input_dict3.get("mapping").values.dtype)
      )
  
      enc = ColumnTransformer(
          transformers=[
              ("onehot_ce", ce.OneHotEncoder(), ["city", "state"]),
              ("onehot_skp", skp.OneHotEncoder(), ["other"]),
          ],
          remainder="passthrough",
      )
  
      enc.fit(train_preprocessed)
      train_preprocessed = pd.DataFrame(
          enc.transform(train_preprocessed), index=train.index
      )
      train_preprocessed.columns = [
          str(feature) for feature in train_preprocessed.columns
      ]
  
      clf = cb.CatBoostClassifier(n_estimators=1).fit(
          train_preprocessed, y
      )
  
      list_dict = [input_dict2, input_dict3]
  
      test_preprocessing = apply_preprocessing(
          train, clf, [input_dict1, list_dict, enc]
      )
      pd.testing.assert_frame_equal(
          train_preprocessed, test_preprocessing
      )
  
imports: import unittest
  import pandas
  import numpy
  import category_encoders
  from sklearn.compose import ColumnTransformer
  import sklearn.preprocessing
  import catboost
  import sklearn
  import lightgbm
  import xgboost
  from shapash.utils.transform import inverse_transform
  from shapash.utils.transform import apply_preprocessing
  from shapash.utils.columntransformer_backend import get_feature_names, get_names, get_list_features_names, get_col_mapping_ct
  from sklearn.ensemble import GradientBoostingClassifier
label_desc: Use image node_id 27 for calling the TestInverseTransformColumnsTransformer obj's underlying member method code with example usage: obj.test_transform_ct_4() without return types