title: After groupby, how to flatten column headers?
body: <p>I'm trying to left join multiple pandas dataframes on a single <code>Id</code> column, but when I attempt the merge I get warning: </p>
  
  <blockquote>
    <p>KeyError: 'Id'. </p>
  </blockquote>
  
  <p>I <em>think</em> it might be because my dataframes have offset columns resulting from a <code>groupby</code> statement, but I could very well be wrong. Either way I can't figure out how to "unstack" my dataframe column headers. None of the answers at <a href="https://stackoverflow.com/q/14507794/896802">this question</a> seem to work.</p>
  
  <p>My <code>groupby</code> code:</p>
  
  <pre><code>step1 = pd.DataFrame(step3.groupby(['Id', 'interestingtabsplittest2__grp'])['applications'].sum())
  step1.sort('applications', ascending=False).head(3)
  </code></pre>
  
  <p>Returns:</p>
  
  <p><a href="https://i.stack.imgur.com/nkbrp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nkbrp.png" alt="offset headers"></a></p>
  
  <p>How to get those offset headers into the top level?</p>