@staticmethod<EOL><INDENT>def agg_single_func(values, agg_field, agg_func, 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_func]})<EOL>res = {}<EOL>for row in group_aggs.itertuples():<EOL><INDENT>res.update({row[<NUM_LIT:0>]: row[<NUM_LIT:1>]})<EOL><DEDENT>return res<EOL><DEDENT>else:<EOL><INDENT>return pd.DataFrame(values).agg({agg_field: [agg_func]})[agg_field][agg_func]<EOL><DEDENT><DEDENT>
Aggregates single function
:param values: list of objects (dict)
:param agg_field: target field to calculate aggregate
:param agg_func: aggregate function
:param group_by: field used to determine group
:return: aggregated value