code: def transform_measures_to_dict(
      feature_balance_measures: Dict[str, pd.DataFrame],
      distribution_balance_measures: pd.DataFrame,
      aggregate_balance_measures: pd.DataFrame,
  ) -> Dict[str, Any]:
      """
      Takes computed data balance measures and transforms them into a
      dictionary acceptable by the RAI dashboard. Even if any set of measures
      fail to be transformed, a valid dict will still be returned.
  
      :param feature_balance_measures: Feature balance measures.
      :type feature_balance_measures: Dict[str, pd.DataFrame]
      :param distribution_balance_measures: Distribution balance measures.
      :type distribution_balance_measures: pd.DataFrame
      :param aggregate_balance_measures: Aggregate balance measures.
      :type aggregate_balance_measures: pd.DataFrame
      :return: A dictionary of data balance measures.
      :rtype: Dict[str, Any]
      """
      feat_measures_dict: Dict[
          str, Dict[str, Any]
      ] = transform_feature_balance_measures(
          dfs=feature_balance_measures
      )
      dist_measures_dict: Dict[
          str, Dict[str, float]
      ] = transform_distribution_balance_measures(
          df=distribution_balance_measures
      )
      agg_measures_dict: Dict[
          str, Dict[str, float]
      ] = transform_aggregate_balance_measures(
          df=aggregate_balance_measures
      )
  
      return {
          FEATURE_BALANCE_MEASURES_KEY: feat_measures_dict,
          DISTRIBUTION_BALANCE_MEASURES_KEY: dist_measures_dict,
          AGGREGATE_BALANCE_MEASURES_KEY: agg_measures_dict,
      }
  
file_path: responsible-ai-toolbox/responsibleai/responsibleai/databalanceanalysis/data_balance_utils.py
imports: import warnings
  from typing import Any, Dict, List
  import pandas
  from responsibleai.databalanceanalysis.constants import Constants
label_desc: Use image node_id 2 for calling a global function with example usage: transform_measures_to_dict(feature_balance_measures, distribution_balance_measures, aggregate_balance_measures) and returns: dict