title: Reshaping a pandas correlation matrix
body: <p>I have the following correlation matrix which was created using pandas: <code>df.corr()</code></p>
  
  <pre><code>symbol       aaa       bbb       ccc       ddd       eee
  symbol                                                  
  aaa     1.000000  0.346099  0.131874 -0.150910  0.177589
  bbb     0.346099  1.000000  0.177308 -0.384893  0.301150
  ccc     0.131874  0.177308  1.000000 -0.176995  0.258812
  ddd    -0.150910 -0.384893 -0.176995  1.000000 -0.310137
  eee     0.177589  0.301150  0.258812 -0.310137  1.000000
  </code></pre>
  
  <p>From the above dataframe, I need to transform it into a 3 column dataframe as follows:</p>
  
  <pre><code>aaa     aaa       1.000000
  aaa     bbb       0.346099
  aaa     ccc       0.131874
  aaa     ddd      -0.150910
  aaa     eee       0.177589
  bbb     aaa       0.346099
  bbb     bbb       1.000000
  bbb     ccc       0.177308
  bbb     ddd      -0.384893
  bbb     eee       0.301150
  ccc     aaa       0.131874
  ccc     bbb       0.177308
  ccc     ccc       1.000000
  ccc     ddd      -0.176995
  ccc     eee       0.258812
  ddd     aaa      -0.150910
  ddd     bbb      -0.384893
  ddd     ccc      -0.176995
  ddd     ddd       1.000000
  ddd     eee      -0.310137
  eee     aaa       0.177589
  eee     bbb       0.301150
  eee     ccc       0.258812
  eee     ddd      -0.310137
  eee     eee       1.000000
  </code></pre>
  
  <p>As shown, it is the same data, just presented differently. Each column/row pair from the original dataframe is simply grouped together into it's own row in the new dataframe.</p>
  
  <p>Unfortunately I can't figure out how to get this done with the result being a dataframe. I have tried doing <code>df.stack()</code> but the the result of this is a <code>Series</code>. I need it to be a dataframe so that I can work with the columns. The other problem with <code>df.stack()</code> is that it does not fill in every row, here is a small sample of the issue:</p>
  
  <pre><code>aaa     aaa       1.000000
          bbb       0.346099
          ccc       0.131874
          ddd      -0.150910
          eee       0.177589
  bbb     aaa       0.346099
          bbb       1.000000
          ccc       0.177308
          ddd      -0.384893
          eee       0.301150
  etc...
  </code></pre>