code: def test_dataframe(experiment_analysis):
      with pytest.raises(ValueError):
          # Invalid mode
          df = experiment_analysis.dataframe(mode="bad")
  
      with pytest.raises(ValueError):
          # Should raise because we didn't pass a metric
          df = experiment_analysis.dataframe(mode="max")
  
      # If we specify `max`, we expect the largets ever observed result
      df = experiment_analysis.dataframe(metric="peak", mode="max")
      assert df.iloc[0]["peak"] == PEAK_VALUE
  
      # If we specify `min`, we expect the lowest ever observed result
      df = experiment_analysis.dataframe(metric="peak", mode="min")
      assert df.iloc[0]["peak"] == -PEAK_VALUE
  
      # If we don't pass a mode, we just fetch the last result
      df = experiment_analysis.dataframe(metric="peak")
      assert df.iloc[0]["peak"] == 0
      assert df.iloc[0]["iter"] == 7
  
imports: from contextlib import contextmanager
  import tempfile
  import os
  from pathlib import Path
  import pickle
  import pandas
  import numpy
  from typing import List
  import pytest
  from ray import train, tune
  from ray.air._internal.uri_utils import URI
  from ray.air.constants import EXPR_PROGRESS_FILE, EXPR_RESULT_FILE
  from ray.train._internal.storage import _delete_fs_path
  from ray.tune.analysis.experiment_analysis import ExperimentAnalysis
  from ray.tune.experiment import Trial
  from ray.tune.utils import flatten_dict
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
  from ray.train.tests.test_new_persistence import mock_s3_bucket_uri
label_desc: Use image node_id 8 for calling a global function with example usage: test_dataframe(experiment_analysis) without return types