code: def X_cats_to_X(X_cats, onehot_dict, X_columns, sep="_"):
      """
      re-onehotencodes a dataframe where onehotencoded columns had previously
      been merged with merge_categorical_columns(...)
  
      Args:
          X_cats (pd.DataFrame): dataframe with merged categorical columns cats
          onehot_dict (dict): dict of features with lists for onehot-encoded variables,
               e.g. {'Fare': ['Fare'], 'Sex' : ['Sex_male', 'Sex_Female']}
          X_columns: list of columns of original dataframe
  
      Returns:
          pd.DataFrame: dataframe X with same encoding as original
      """
      non_cat_cols = [col for col in X_cats.columns if col in X_columns]
      X_new = X_cats[non_cat_cols].copy()
      for cat, cols in onehot_dict.items():
          if len(cols) > 1:
              for col in cols:
                  X_new[col] = (X_cats[cat] == col).astype(np.int8)
      return X_new[X_columns]
  
imports: from functools import partial
  import re
  from collections import Counter
  from typing import List, Union
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype, is_categorical_dtype
  from dtreeviz.trees import ShadowDecTree
  from sklearn.metrics import make_scorer
  from sklearn.base import clone
  from sklearn.pipeline import Pipeline
  from sklearn.model_selection import KFold, StratifiedKFold
  from joblib import Parallel, delayed
label_desc: Use image node_id 13 for calling a global function with example usage: X_cats_to_X(X_cats, onehot_dict, X_columns, sep) and returns: X_new