I have a 2d list [index, value] with repeated indexes. I need to select unique indexes with most often occurring value or if values seen equal number of times - the last one.
[
[0,-1],
[1, 0],
[1, 1],
[2, 1],
[2,-1],
[2, 1],
]
=>
[
[0,-1],
[1, 1], # last seen
[2, 1], # most often seen
]
I can use numpy
or any other popular lib instead if it makes it easier