How to find the rank of the user by value.
data = [
{
"playerId": 2,
"value": 196763.8
},
{
"playerId": 3,
"value": 196763.8
},
{
"playerId": 44,
"value": 196764
}
]
I have tried:
index = [ x['playerId'] for x in data ].index(3) #3 playerId
rank = index+1
I am getting rank is: 2
Rank should be 1 for playerId 2 and 3 (because value are same 196763.8 ) and for playerId 44 rank will be 2