title: Reshaping a multiindex pandas dataframe
body: <p>I have a multiindex pandas dataframe that looks like this</p>
  
  <pre><code> ID            I                   II                  III
   METRIC        a    b    c    d    a    b    c    d    a    b    c    d
   2015-08-01    0    1    2    3    20   21   22   23   40   41   42   43
   2015-08-02    4    5    6    7    24   25   26   27   44   45   46   47
   2015-08-03    8    9    10   11   28   29   30   31   48   49   50   51
  </code></pre>
  
  <p>where it is indexed by the dates (<code>2015-08-01</code>, <code>2015-08-02</code>, <code>2015-08-03</code>, etc.), the first-level columns (<code>I</code>, <code>II</code>, <code>III</code>) are <code>ID</code>s and the second-level columns are corresponding <code>METRIC</code>s (<code>a</code>, <code>b</code>, <code>c</code>, <code>d</code>). I would like to reshape it to the following</p>
  
  <pre><code>METRIC               a    b    c    d
  ID
  I      2015-08-01    0    1    2    3
         2015-08-02    4    5    6    7
         2015-08-03    8    9    10   11
  II     2015-08-01    20   21   22   23
         2015-08-02    24   25   26   27
         2015-08-03    28   29   30   31
  III    2015-08-01    40   41   42   43
         2015-08-02    44   45   46   47
         2015-08-03    48   49   50   51
  </code></pre>
  
  <p>I have (unsuccessfully) looked into using <code>.pivot</code>, <code>.stack</code>, and <code>.melt</code>, but they don't give me what I am looking for. I currently loop over <code>ID</code>s and build a <em>list</em> of dataframes and <code>concat</code> them together as a new dataframe to get what I want.</p>
  
  <p>Any suggestions would be greatly appreciated.</p>