title: More elegant computation of zscore of column differences in Pandas
body: <p>I have a <code>n x m</code> DataFrame quantifying the expression of <code>n</code> genes in <code>m</code> areas. I want to calculate the number of genes differentially expressed between all pairs of areas. </p>
  
  <pre><code>               Area                             Area
   Gene    A     B     C            Area    A    B    C             
    a                                 A 
    b                      --&gt;        B     x
    c                                 C
  </code></pre>
  
  <p>In the above sketch, x denotes the number of genes common to regions <code>A</code> and <code>B</code> that are enriched in area <code>B</code>.  <strong>I need to calculate the zscores of all pairwise column differences.</strong></p>
  
  <p><strong>Current approach</strong></p>
  
  <pre><code>def compare(one,two):
       column_one_header,column_one_data = one
       column_two_header,column_two_data = two
       zscores =  zscore(column_one_data-column_two_data)
       return len(zscores[zscores&gt;threshold])
  
  
   heatmap = [[compare(column_one,column_two)
               for column_one in df.iteritems()]
               for column_two in df.iteritems()]
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/21467429/pairwise-matrix-from-a-pandas-dataframe">This question</a> suggests that there is a simpler and faster way to do this. In contrast to that question, I want to do multiple operations. I'm not sure how to write a similar one-liner for my issue. </p>