

def apply(self, data, sort=True):
    if sort:
        data = sorted(data, key=self.attrgetter(*self.group_bys_cols))
    result = []
    for (grouped, items) in groupby(data, key=self.attrgetter(*self.group_bys_cols)):
        items = list(items)
        result_item = [self.format_columns(grouped)]
        for aggr_by_col in self.aggr_by_cols:
            result_item.append(aggr_by_col[0](items, aggr_by_col[1]))
        result.append(result_item)
    return result

dataset/ETHPy150Open dpgaspar/Flask-AppBuilder/flask_appbuilder/models/group.py GroupByProcessData.apply/original