title: Converting columns to rows in Pandas with a secondary index value
body: <p>Following up to my previous question <a href="https://stackoverflow.com/questions/58767731/converting-columns-with-date-in-names-to-separate-rows-in-python">here</a>: </p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  d = pd.DataFrame({'value':['a', 'b'],'2019Q1':[1, 5], '2019Q2':[2, 6], '2019Q3':[3, 7]})
  
  </code></pre>
  
  <p>which displays like this:</p>
  
  <pre><code>   value    2019Q1  2019Q2  2019Q3
  0  a        1       2       3
  1  b        5       6       7
  </code></pre>
  
  <p>How can I transform it into this shape:</p>
  
  <pre><code>Year    measure    Quarter    Value
  2019    a          1          1
  2019    a          2          2
  2019    a          3          3
  2019    b          1          5
  2019    b          2          6
  2019    b          3          7
  </code></pre>