labels = ['x', 'x', 'y']
data = [100, 200, 1000]
labels = ['x', 'y']
data = [300, 1000]
new_labels = []
new_data = []
for l, d in zip(labels, data):
if l in new_labels:
new_data[new_labels.index(l)] += d
else:
new_labels.append(l)
new_data.append(d)