I have a list of three item tuples. The first two items are often duplicates (GPS co-ordinates) while the last item is a score (signal strength)
[(62.45807, -114.41026, 8),
(62.45807, -114.41026, 11),
(62.45807, -114.41026, 18),
(62.45807, -114.41026, 16),
(62.45807, -114.41026, 9),
(62.45785, -114.41003, 23),
(62.45785, -114.41003, 19),
(62.45785, -114.41003, 11),
(62.45785, -114.41003, 17),
(62.45785, -114.41003, 14),
(62.45785, -114.41003, 11),
(62.45785, -114.41003, 15),
(62.45765, -114.40978, 28),
(62.45765, -114.40978, 16),
(62.45765, -114.40978, 10),
(62.45765, -114.40978, 15),
(62.45765, -114.40978, 25)]
I would like to know how to remove the duplicate GPS co-ordinates while preferring the highest score to end up with this:
[(62.45807, -114.41026, 18),
(62.45785, -114.41003, 23),
(62.45765, -114.40978, 28)]
And how to do the same but average the scores to end up with something like this
[(62.45807, -114.41026, 12),
(62.45785, -114.41003, 16),
(62.45765, -114.40978, 19)]