title: Rank a list of numbers, allowing for ties
body: <p>Lets say I have a list like this:</p>
  
  <pre><code>newIndexVertList = [0, 1, 2, 2, 1, 20, 21, 21, 20, 3, 23, 22]
  </code></pre>
  
  <p>I want to convert it to:</p>
  
  <pre><code>newIndexVertList = [0, 1, 2, 2, 1, 4, 5, 5, 4, 3, 7, 6]
  </code></pre>
  
  <p>Here, the transformation is based on the position of number in ascending order in the original list. Hence, in the new list numbers are replaced based on the logic:</p>
  
  <pre><code>0   --&gt;  0    0th position in sorted list
  1   --&gt;  1    1st position in sorted list
  2   --&gt;  2    2nd position in sorted list
  3   --&gt;  3    3rd position in sorted list
  20  --&gt;  4    4th position in sorted list
  21  --&gt;  5    5th position in sorted list
  22  --&gt;  6    6th position in sorted list
  23  --&gt;  7    7th position in sorted list
  </code></pre>
  
  <p>Below is my code to achieve this:</p>
  
  <pre><code>c = 0
  for i in xrange(len(newIndexVertList)):
      if c &lt; newIndexVertList[i]:
          newIndexVertList[i] = c
          c += 1
          continue
      elif c == newIndexVertList[i]:
          c += 1
          continue
      else:
          continue
  
  # actual output:   [0, 1, 2, 2, 1, 3, 4, 5, 6, 3, 7, 8]
  # expected output: [0, 1, 2, 2, 1, 4, 5, 5, 4, 3, 7, 6]
  </code></pre>
  
  <p>What is the issue with my code? What is the elegant way to achieve this?</p>
  
  <p><strong>Since my vertex lists will be in the 100k range, I'm looking for the quickest execution.</strong></p>