title: Correlation coefficients and p values for all pairs of rows of a matrix
body: <p>I have a matrix <code>data</code> with <em>m</em> rows and <em>n</em> columns. I used to compute the correlation coefficients between all pairs of rows using <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.corrcoef.html" rel="noreferrer"><code>np.corrcoef</code></a>:</p>
  
  <pre><code>import numpy as np
  data = np.array([[0, 1, -1], [0, -1, 1]])
  np.corrcoef(data)
  </code></pre>
  
  <p>Now I would also like to have a look at the p-values of these coefficients. <code>np.corrcoef</code> doesn't provide these; <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.pearsonr.html" rel="noreferrer"><code>scipy.stats.pearsonr</code></a> does. However, <code>scipy.stats.pearsonr</code> does not accept a matrix on input. </p>
  
  <p>Is there a quick way how to compute both the coefficient and the p-value for all pairs of rows (arriving e.g. at two <em>m</em> by <em>m</em> matrices, one with correlation coefficients, the other with corresponding p-values) without having to manually go through all pairs?</p>