I am just a beginner in python. I have document score= {1:0.98876, 8:0.12245, 13:0.57689}
which is stored in dictionary. The keys are corresponding to a series of document id and the values are corresponding to the score for each document id. How do I rank the document based on the scores?
inverse=[(value, key) for key, value in score.items()]
fmax=max(inverse)
I already found the maximum values by using the method above which return:
(0.98876,1)
But what I want is to rank the documents and store in a list:
{(0.98876,1),(0.57689,13),(0.12245,8)}