title: Create Nested JSON from Pandas for Org Chart
body: <p>I'm trying to create a nested JSON object from a hierarchical DataFrame (python 3.5) to feed into JavaScript to render an Org Chart.  I'm essentially trying to create the structure found in the answer of this question: <a href="https://stackoverflow.com/questions/30926539/organization-chart-tree-online-dynamic-collapsible-pictures-in-d3">Organization chart - tree, online, dynamic, collapsible, pictures - in D3</a></p>
  
  <p>An example dataframe:</p>
  
  <pre><code>df = pd.DataFrame({\
  'Manager_Name':['Mike' ,'Jon', 'Susan' ,'Susan' ,'Joe'],\
  'Manager_Title':['Level1' ,'Level2'  ,'Level3' ,"Level3", 'Level4'],\
  'Employee_Name':['Jon' ,'Susan' ,'Josh' ,'Joe' ,'Jimmy'],\
  'Employee_Title':["Level2" ,"Level3" ,"Level4" ,"Level4" ,"Level5"]})
  </code></pre>
  
  <p>The desired output would be:</p>
  
  <pre><code>"Name": "Mike"
  "Title": "Level1"
  "Employees": [{
          "Name": "Jon"
          "Title": "Level2"
          "Employees": [{
                 "Name": "Susan"
                 "Title": "Level3"
                 "Employees": [{
                 ...
                 ...
                 ...
                 }]
        }]
  }]
  </code></pre>
  
  <p>I know this isn't a code generating service but I've tried applying other similarly related answers and can't seem to apply those answers here.  I also haven't worked with dictionaries that much (I'm more of an R person) so there's probably some noobishness to this question.  I've more time than I should on this yet I'm sure someone here can do this in a few minutes.  </p>
  
  <p>Other questions: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/24374062/pandas-groupby-to-nested-json">pandas groupby to nested json</a></li>
  <li><a href="https://stackoverflow.com/questions/23255512/creating-nested-json-structure-with-multiple-key-values-in-python-from-json">Creating nested Json structure with multiple key values in Python from Json</a></li>
  <li><a href="https://stackoverflow.com/questions/37713329/how-to-build-a-json-file-with-nested-records-from-a-flat-data-table?noredirect=1&amp;lq=1">How to build a JSON file with nested records from a flat data table?</a></li>
  </ul>
  
  <p>Thanks in advance!</p>