class_docstr: Results from computing metrics.
class_docstr_tok: ["Results","from","computing","metrics","."]
docstr: Output the metrics as a pandas dataframe.
docstr_tok: ["Output","the","metrics","as","a","pandas","dataframe","."]
code: def to_df(self) -> pandas.DataFrame:
      """Output the metrics as a pandas dataframe."""
      one_key = next(iter(self.data.keys()))
      # assert isinstance(one_key, NamedTuple)
      one_key_nt = cast(NamedTuple, one_key)
      columns = [field.capitalize() for field in one_key_nt._fields] + [
          "Value"
      ]
      return pandas.DataFrame(
          [(*key, value) for key, value in self.data.items()],
          columns=columns,
      )
  
imports: from __future__ import annotations
  import logging
  import timeit
  import warnings
  from abc import ABC, abstractmethod
  from collections import ChainMap
  from typing import Any, ClassVar, Collection, Generic, List, Mapping, NamedTuple, Optional, Tuple, Type, TypeVar, Union, cast
  import pandas
  import torch
  from torch_max_mem import maximize_memory_utilization
  from tqdm.autonotebook import tqdm
  from ..constants import COLUMN_LABELS, TARGET_TO_INDEX, TARGET_TO_KEY_LABELS
  from ..metrics.utils import Metric
  from ..models import Model
  from ..triples.triples_factory import restrict_triples
  from ..triples.utils import get_entities, get_relations
  from ..typing import LABEL_HEAD, LABEL_RELATION, LABEL_TAIL, InductiveMode, MappedTriples, Target
  from ..utils import flatten_dictionary, format_relative_comparison, normalize_string, prepare_filter_triples
label_desc: Use image node_id 8 for calling the MetricResults obj's underlying member method code with example usage: obj.to_df() and returns: pandas