code: def apply_to_dataframe(
      data: pd.DataFrame,
      metric_functions: Dict[str, AnnotatedMetricFunction],
  ) -> pd.Series:
      """Apply metric functions to a DataFrame.
  
      The incoming DataFrame may have been sliced via `groupby()`.
      This function applies each annotated function in turn to the
      supplied DataFrame.
      """
      values = dict()
      for function_name, metric_function in metric_functions.items():
          values[function_name] = metric_function(data)
      # correctly handle zero provided metrics
      if len(values) == 0:
          result = pd.Series(dtype=float)
      else:
          result = pd.Series(values)
      return result
  
file_path: fairlearn/fairlearn/metrics/_disaggregated_result.py
imports: import logging
  from typing import Dict, List, Optional, Union
  import numpy
  import pandas
  from ._annotated_metric_function import AnnotatedMetricFunction
label_desc: Use image node_id 2 for calling a global function with example usage: apply_to_dataframe(data, metric_functions) and returns: result