rhino_health.lib.metrics.metric_utils#

Module Contents#

Functions#

nested_metric_groups(→ Dict[str, Any])

Converts a dictionary of grouped metrics to a nested dictionary

rhino_health.lib.metrics.metric_utils.nested_metric_groups(grouped_metric_results: Dict[Tuple | str, Any]) Dict[str, Any]#

Converts a dictionary of grouped metrics to a nested dictionary

Examples

>>> input = {"('F', False)": {'count': 20}, "('F', True)": {'count': 14}, "('M', False)": {'count': 17}, "('M', True)": {'count': 25}}
>>> nested_metric_groups(input)
{'F': {False: { 'count': 20 }, True: { 'count': 14} }, 'M': {False: { 'count': 17 }, True: { 'count': 25 }}}

Warning

How groups are represented will likely change in the future and this function will change in future versions