a = [('x', 1), ('x', 2), ('y', 1), ('y', 3), ('y', 4)]
d = {}
for k, v in a:
    d.setdefault(k, [k]).append(v)
b = map(tuple, list(d.values()))
b
Python list of tuples merge 2nd element with unique first element