Group the given data according to the given specification.
(
metrics_df: pd.DataFrame,
plotters: Collection[Plotter],
metadata: Collection[BenchmarkMetadata],
spec: GroupingSpec,
)
| 121 | |
| 122 | |
| 123 | def group( |
| 124 | metrics_df: pd.DataFrame, |
| 125 | plotters: Collection[Plotter], |
| 126 | metadata: Collection[BenchmarkMetadata], |
| 127 | spec: GroupingSpec, |
| 128 | ) -> Sequence[Tuple[Tuple[str, ...], pd.DataFrame, Collection[Plotter]]]: |
| 129 | """ |
| 130 | Group the given data according to the given specification. |
| 131 | """ |
| 132 | result = _group(metrics_df, plotters, metadata, spec.by) |
| 133 | |
| 134 | if spec.minimise: |
| 135 | # Terribly inefficient, but it's probably fast enough. |
| 136 | for candidate_by in _iter_by(spec.by): |
| 137 | candidate_result = _group(metrics_df, plotters, metadata, candidate_by) |
| 138 | if len(result) == len(candidate_result): |
| 139 | return candidate_result |
| 140 | |
| 141 | return result |
| 142 | |
| 143 | |
| 144 | def _group( |
searching dependent graphs…