title: Python Scipy: scipy.stats.spearmanr returning nans
body: <p>Edit: Basically solved I think.</p>
  
  <p>I am using spearmanr from scipy.stats to find the correlations between variables across a number of different samples. I have around 2500 variables and 36 samples (or 'observations')</p>
  
  <p>If I calculate the correlations using all 36 samples, spearmanr works fine. If I use only the first 18 samples it also works fine. However if I use the latter 18 samples I get an error and nans are returned.</p>
  
  <p>This is the error:</p>
  
  <pre><code>/Home/s1215235/.local/lib/python2.7/site-packages/numpy/lib/function_base.py:1945: RuntimeWarning: invalid value encountered in true_divide
  return c / sqrt(multiply.outer(d, d))
  /Home/s1215235/.local/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py:1718: RuntimeWarning: invalid value encountered in greater
  cond1 = (scale &gt; 0) &amp; (x &gt; self.a) &amp; (x &lt; self.b)
  /Home/s1215235/.local/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py:1718: RuntimeWarning: invalid value encountered in less
  cond1 = (scale &gt; 0) &amp; (x &gt; self.a) &amp; (x &lt; self.b)
  /Home/s1215235/.local/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py:1719: RuntimeWarning: invalid value encountered in less_equal
  cond2 = cond0 &amp; (x &lt;= self.a)
  </code></pre>
  
  <p>This is the code:</p>
  
  <pre><code>populationdata = np.vstack(thing).astype(np.float)
  rho, pval = stats.spearmanr(populationdata[:,sampleindexes], axis = 1)
  </code></pre>
  
  <p>(populationdata is a numpy array full of floats; [:,sampleindexes] allows only a few of the columns to be used.</p>
  
  <p>And this is what rho is returned as:</p>
  
  <pre><code>[[ 1.                 nan         nan ...,  1.         -0.05882353
    -0.08574929]
   [        nan         nan         nan ...,         nan         nan
            nan]
   [        nan         nan         nan ...,         nan         nan
            nan]
   ..., 
   [ 1.                 nan         nan ...,  1.         -0.05882353
    -0.08574929]
   [-0.05882353         nan         nan ..., -0.05882353  1.          0.68599434]
   [-0.08574929         nan         nan ..., -0.08574929  0.68599434  1.        ]]
  </code></pre>