captest.capdata.CapData.agg_group
- CapData.agg_group(group_id, agg_func, verbose=True, rename_map=None, inplace=True, cutoff=10, columns=None)
Aggregate columns in a group.
- Parameters:
group_id (str) – Key from column_groups attribute.
agg_func (str or callable) – Aggregation function to apply.
verbose (bool, default True) – Set to True to print the columns that have been aggregated, the aggregation function used, and the new column name.
cutoff (int, default 10) – Maximum number of columns to list individually when
verbose=True. When the group contains more columns than this value, the first three and last three column names are printed with an ellipsis in between. Increase this value to see more columns listed individually.columns (pd.DataFrame or None, default None) – Pre-fetched DataFrame of columns to aggregate. When provided the lookup via
self._get_groupis skipped. Intended for internal use byagg_sensorsto avoid a redundant lookup.
Notes
When
agg_funcis"sum"the aggregation is performed withmin_count=1so that a row in which every column isNaNreturnsNaNrather than0.0(the pandas default). Rows with at least one value still skipNaNand sum the remaining values.