title: Spearman rank correlation in Python with ties
body: <p>I want to compute the <a href="https://en.wikipedia.org/wiki/Spearman&#39;s_rank_correlation_coefficient" rel="nofollow noreferrer">spearman rank correlation</a> using Python and most likely scipy implementation (scipy.stats.spearmanr).</p>
  
  <p>The data at hand looks e.g., the following way (dictionaries):</p>
  
  <pre><code>{a:0.3, b:0.2, c:0.2} and {a:0.5, b:0.6, c:0.4}
  </code></pre>
  
  <p>To now pass it over to the spearman module, I would assign them ranks, if I am correct (descending):</p>
  
  <pre><code>[1,2,3] and [2,1,3]
  </code></pre>
  
  <p>So now I want to consider ties, so would I now use for the first vector:</p>
  
  <pre><code>[1,2,2] or [1,2.5,2.5]
  </code></pre>
  
  <p>Basically, is this whole concept correct and how to handle ties for such dictionary-based data.</p>
  
  <p>As suggested by @Jaime the spearmanr function works with values, but why is this behavior possible:</p>
  
  <pre><code>In [5]: spearmanr([0,1,2,3],[1,3,2,0])
  Out[5]: (-0.39999999999999997, 0.59999999999999998)
  
  In [6]: spearmanr([10,7,6,5],[0.9,0.5,0.6,1.0])
  Out[6]: (-0.39999999999999997, 0.59999999999999998)
  </code></pre>
  
  <p>Thanks!</p>