title: Python Ranking Dictionary Return Rank
body: <p>I have a python dictionary: </p>
  
  <p><code>x = {'a':10.1,'b':2,'c':5}</code></p>
  
  <p>How do I go about ranking and returning the rank value? Like getting back:</p>
  
  <p><code>res = {'a':1,c':2,'b':3}</code></p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <p>I am not trying to sort as that can be done via <code>sorted</code> function in python. I was more thinking about getting the rank values from highest to smallest...so replacing the dictionary values by their position after sorting. 1 means highest and 3 means lowest.</p>