code: def test_result_grid_df(ray_start_2_cpus):
      def f(config):
          train.report(dict(metric=config["nested"]["param"] * 1))
          train.report(dict(metric=config["nested"]["param"] * 4))
          train.report(dict(metric=config["nested"]["param"] * 3))
  
      analysis = tune.run(
          f, config={"nested": {"param": tune.grid_search([1, 2])}}
      )
      result_grid = ResultGrid(analysis)
  
      assert len(result_grid) == 2
  
      # Last result
      df = result_grid.get_dataframe()
      assert sorted(df["metric"]) == [3, 6]
  
      # Best result (max)
      df = result_grid.get_dataframe(
          filter_metric="metric", filter_mode="max"
      )
      assert sorted(df["metric"]) == [4, 8]
  
      # Best result (min)
      df = result_grid.get_dataframe(
          filter_metric="metric", filter_mode="min"
      )
      assert sorted(df["metric"]) == [1, 2]
  
      assert sorted(df["config/nested/param"]) == [1, 2]
  
file_path: ray/python/ray/tune/tests/test_result_grid.py
imports: import pytest
  import ray
  from ray import train, tune
  from ray.train import Checkpoint, Result
  from ray.tune.result_grid import ResultGrid
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
label_desc: Use image node_id 8 for calling a global function with example usage: test_result_grid_df(ray_start_2_cpus) without return types