@staticmethod<EOL><INDENT>def agg_multi_func(values, agg_field, agg_funcs, group_by=None):<DEDENT>
if len(values) == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>if group_by:<EOL><INDENT>group_aggs = pd.DataFrame(values).groupby(group_by).agg({agg_field: agg_funcs})<EOL>res = {}<EOL>for row in group_aggs.itertuples():<EOL><INDENT>row_res = {}<EOL>for i, func in enumerate(agg_funcs):<EOL><INDENT>row_res.update({func: row[i+<NUM_LIT:1>]})<EOL><DEDENT>res.update({row[<NUM_LIT:0>]: row_res})<EOL><DEDENT>return res<EOL><DEDENT>else:<EOL><INDENT>aggs = pd.DataFrame(values).agg({agg_field: agg_funcs})<EOL>res = {}<EOL>for func in agg_funcs:<EOL><INDENT>res.update({func: aggs[agg_field][func]})<EOL><DEDENT>return res<EOL><DEDENT><DEDENT>
Aggregates several functions
:param values: list of objects (dict)
:param agg_field: target field to calculate aggregates
:param agg_funcs: list of aggregate functions
:param group_by: field used to determine group
:return: dict {agg_func0: value, agg_func1: agg_value, ...}