(
df: pd.DataFrame,
primary_grouping: Callable[[pd.DataFrame], Any],
secondary_grouping: Callable[[pd.DataFrame], Any],
file,
print_total=False,
)
| 241 | |
| 242 | |
| 243 | def two_level_summary( |
| 244 | df: pd.DataFrame, |
| 245 | primary_grouping: Callable[[pd.DataFrame], Any], |
| 246 | secondary_grouping: Callable[[pd.DataFrame], Any], |
| 247 | file, |
| 248 | print_total=False, |
| 249 | ): |
| 250 | primary_group = primary_grouping(df) |
| 251 | |
| 252 | with pd_print_all(): |
| 253 | for group, data in sorted(primary_group, key=lambda item: item[0]): |
| 254 | print(" ".join(group), file=file) |
| 255 | |
| 256 | secondary_group = secondary_grouping(data) |
| 257 | for group, results in sorted(secondary_group, key=lambda item: item[0]): |
| 258 | stats = results["duration"].describe() |
| 259 | duration_str = f"{stats['mean']:.4f} s" |
| 260 | if stats["count"] > 1: |
| 261 | duration_str += f" (min={stats['min']:.4f}, max={stats['max']:.4f}, std={stats['std']:.4f})" |
| 262 | print(f"\t{' '.join(group)}: {duration_str}", file=file) |
| 263 | if print_total: |
| 264 | mean_duration = data["duration"].mean() |
| 265 | print(f"(mean): {mean_duration:.4f} s", file=file) |
| 266 | |
| 267 | print(file=file) |
| 268 | |
| 269 | |
| 270 | def generate_comparison_html(benchmarks: List[str], database: Database, directory: Path): |
no test coverage detected