I have a list like this:
[['john', 14, 'USA'],['john', 27, 'USA'],['paul', 17, 'USA'],['paul', 36, 'USA']]
And need to get as output:
[['john', 27, 'USA'],['paul', 36, 'USA']]
This means to remove duplicates based on position 0 but keep the ones with the higher value in position 1.
I know how to remove duplicates on regular lists using set(), but how do I go about applying those 2 conditions? I was thinking something with a for but i might be very slow since the real lists I'll use are very large.
I already tried to remove duplicates just by names but I'm puzzled about keeping the one with the higher value.
Thanks!