code: def get_mean_absolute_shap_df(columns, shap_values, onehot_dict=None):
      """
      Returns a dataframe with the mean absolute shap values for each feature.
  
      Args:
          columns (list of str): list of column names
          shap_values (np.ndarray): 2d array of SHAP values
          onehot_dict (dict): dict of features with lists for onehot-encoded variables,
               e.g. {'Fare': ['Fare'], 'Sex' : ['Sex_male', 'Sex_Female']}
  
      Returns:
          pd.DataFrame with columns 'Feature' and 'MEAN_ABS_SHAP'.
      """
      if onehot_dict is None:
          onehot_dict = {col: [col] for col in columns}
      columns = pd.Index(columns)
      shap_abs_mean_dict = {}
      for col_name, col_list in onehot_dict.items():
          shap_abs_mean_dict[col_name] = np.absolute(
              shap_values[
                  :, [columns.get_loc(col) for col in col_list]
              ].sum(axis=1)
          ).mean()
  
      shap_df = (
          pd.DataFrame(
              {
                  "Feature": list(shap_abs_mean_dict.keys()),
                  "MEAN_ABS_SHAP": list(shap_abs_mean_dict.values()),
              }
          )
          .sort_values("MEAN_ABS_SHAP", ascending=False)
          .reset_index(drop=True)
      )
      return shap_df
  
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 19 for calling a global function with example usage: get_mean_absolute_shap_df(columns, shap_values, onehot_dict) and returns: shap_df