title: Pandas Group Columns into Level
body: <p>Assume I have a dataframe of the form:</p>
  
  <pre><code>&gt;&gt;&gt; df = pd.DataFrame([['2012', 'A', 1], ['2012', 'B', 2], ['2011', 'A', 3], 
                         ['2011', 'B', 2]],
                        columns=['branch_year', 'branch_name', 'employee_id'])
  
    branch_year branch_name  employee_id
  0        2012           A            1
  1        2012           B            2
  2        2011           A            3
  3        2011           B            2
  </code></pre>
  
  <p>How can I combine columns <code>branch_year</code> and <code>branch_name</code> so that they have a parent column <code>branch</code> -- and ideally renaming them to get rid of <code>branch_</code> prefix.</p>
  
  <pre><code>       branch      branch  employee_id
           year        name
  0        2012           A            1
  1        2012           B            2
  2        2011           A            3
  3        2011           B            2
  </code></pre>
  
  <p>The end goal is to create a list of dictionaries of the form:</p>
  
  <pre><code>[
      {
        "employeed_id": 1,
        "branch": {
                    "name": "A",
                    "year": "2012"
        }
      },
      {...}
  ]
  </code></pre>