0

Given is a list of pairs. I want to replace the second element of all pairs with the median of the second elements of all pairs with the same first element.
For example:
[("a",1.0),("b",3.0),("a",2.0),("a",4.0)]
->
[("a",2.0),("b",3.0),("a",2.0),("a",2.0)]
The order of the elements in the res...