from collections import defaultdict
pos_group_dict = defaultdict(list)
for data_dict in data:
pos_group_dict[(data_dict['name'], data_dict['id'])].append(data_dict['pos'])
new_data = [{'name': key[0], 'id': key[1], 'pos': value} for key, value in pos_group_dict.items()]