nicetoolbox.evaluation.data.summary.resolve_group_levels¶
- nicetoolbox.evaluation.data.summary.resolve_group_levels(df: DataFrame, meta_type: type[nicetoolbox.evaluation.data.input_loader.NpzMeta], group_by: GroupBySpec, exclude: frozenset[str] = frozenset({'frame'})) list[str][source]¶
Return the columns to group by for a categorical metric computation.
Always includes always_iterate columns from meta_type that are present in df, then adds user-requested dimensions from group_by, minus anything in exclude.
- Parameters:
df – DataFrame containing the metric data to be grouped.
meta_type – NpzMeta subclass whose always_iterate() defines mandatory grouping keys.
group_by – User-specified grouping dimensions.
exclude – Column names to never include in the result.
- Returns:
Ordered list of column names to pass to a groupby call.