code: def _prepare_results(
      results: list[Result],
      dataset_split: Literal["train", "validation", "test"],
  ) -> pd.DataFrame:
      """Method to prepare the results object for the creation of bootstrap estimates.
  
      Parameters
      ----------
      results : list[Result]
          List of results objects.
      dataset_split : Literal["train", "validation", "test"]
          Dataset split to use for the bootstrap estimates.
  
      Returns
      -------
      pd.DataFrame
          DataFrame with the results for the given dataset split.
      """
      # Validate the dataset_split argument
      if dataset_split not in ["train", "validation", "test"]:
          raise AttributeError(
              "Invalid split definition for prepare_results"
          )
  
      results_property = f"{dataset_split}_results"
      metrics = getattr(results[0], results_property).keys()
      data = {
          metric: [
              getattr(result, results_property)[metric]
              for result in results
          ]
          for metric in metrics
      }
      return pd.DataFrame(data)
  
file_path: aequitas/src/aequitas/fairflow/utils/evaluation.py
imports: from typing import Literal, Union
  import numpy
  import pandas
  from ..evaluation import Result
label_desc: Use image node_id 1 for calling a global function with example usage: _prepare_results(results, dataset_split) and returns: pd