What is the most pythonic way to group by multiple keys and summarize/average values of a list of dictionaries in Python please? Say I have a list of dictionaries as below:<
Using the numpy EP you can find here, you could write:
inputs = dict( (k, [i[k] for i in input ]) for k in input[0].keys())
print group_by((inputs['dept'], inputs['sku'])).mean(inputs['qty'])
However, you may want to consider using the pandas package if you are doing a lot of relational operations of this kind.