From 091058bbccddd9aa9796c3152ad78c252d813288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Caron?= Date: Fri, 6 Dec 2024 20:38:26 +0100 Subject: [PATCH] Add Results.nb_rows property --- CHANGELOG.md | 3 ++- qpbenchmark/results.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b30857d..4580a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,9 @@ All notable changes to this project will be documented in this file. - Add `ProblemList` class that can be saved to Parquet files - Allow strings or paths as arguments to the main function - CLI: Add `list_problems` command -- Optionally add a GPU summary line to reports - New dependency: tqdm +- Optionally add a GPU summary line to reports +- Results property to get the number of result rows - Very-verbose mode for extra debug messages ### Changed diff --git a/qpbenchmark/results.py b/qpbenchmark/results.py index 5d83722..55a9e80 100644 --- a/qpbenchmark/results.py +++ b/qpbenchmark/results.py @@ -89,6 +89,11 @@ def __init__(self, csv_path: Optional[str], test_set: TestSet): self.df = test_set_df self.test_set = test_set + @property + def nb_rows(self) -> int: + """Number of rows in the dataframe.""" + return self.df.shape[0] + def write(self, path: Optional[str] = None) -> None: """Write results to their CSV file for persistence.