Apply function per group of values of a key in list of dicts
问题 Let's suppose I have this: my_list = [{'id':'1','value':'1'}, {'id':'1','value':'8'}, {'id':'2','value':'2'}, {'id':'2','value':'3'}, {'id':'2','value':'5'}, ] and I want to apply a function (eg shuffle ) for each group of values separately for the key id . So I would like to have this for example: my_list = [{'id':'1','value':'1'}, {'id':'1','value':'8'}, {'id':'2','value':'3'}, {'id':'2','value':'5'}, {'id':'2','value':'2'}, ] Therefore I do not want something to change between the