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:<
@thefourtheye If we use groupby only one key, we should check the type of key after group, if not a tuple, return a list.
groupby
for key, grp in groupby(sorted(input_data, key = grouper), grouper): if not isinstance(key, tuple): key = [key]