from collections import defaultdict
result = defaultdict(int)
for row in data:
    key = row[1], row[2]
result[key] += int(row[0])
Best way to compare a in a list of list and add a different value with python