title: Create Interactive hierarchy diagram from pandas/dictionary
body: <p>I have data that shows the relationship for each employee with their managers(Person:Manager) -</p>
  
  <pre><code>data = {'PersonX':'Person1', 'PersonY':'Person1', 'PersonZ':'Person 2', 'Person1':'Person100','Person2':'Person100' }
  </code></pre>
  
  <p>I am trying to show a hierarchy chart from the above data in a clean looking chart and if I can filter that data in the visualization itself that is a Bonus.</p>
  
  <p>The data that I get can contain sometimes 5 people or sometimes the number of records is more than 5000.</p>
  
  <p>I have tried these approaches but they are no where close to generating any graphs that are  interactive. </p>
  
  <p><strong>Code -</strong> </p>
  
  <p><strong>Try 1 -</strong></p>
  
  <pre><code>import pandas as pd
  import networkx as nx
  
  d = {'PersonX': 'Person1', 'PersonY': 'Person1', 'PersonZ': 'Person2', 'Person1': 'Person100', 'Person2': 'Person100'}
  df = pd.DataFrame(d.items(), columns=['Person', 'Manager'])
  G = nx.from_pandas_edgelist(df,  source='Person', target='Manager')
  nx.draw(G, with_labels=True)
  plt.show()
  </code></pre>
  
  <p><a href="https://imgur.com/jKdJUid" rel="noreferrer"><img src="https://imgur.com/jKdJUid" alt="Network X graph"></a></p>
  
  <p><strong>Try 2 -</strong></p>
  
  <pre><code>import pandas as pd
  import matplotlib.pyplot as plt
  from sklearn.preprocessing import LabelEncoder
  from scipy.cluster import hierarchy
  df2 = df.apply(LabelEncoder().fit_transform)
  df2.set_index('Manager', inplace=True)
  Z = hierarchy.linkage(df2, 'ward')
  hierarchy.dendrogram(hierarchy.linkage(df2, method='ward'))
  plt.show()
  </code></pre>
  
  <p><a href="https://imgur.com/fV2zuG6" rel="noreferrer"><img src="https://imgur.com/fV2zuG6" alt="Attempt 2nd"></a></p>
  
  <p><strong>Try 3 -</strong></p>
  
  <pre><code>print('strict digraph tree {')
  for row in d.items():
      print('    {0} -&gt; {1};'.format(*row))
  print('}')
  </code></pre>
  
  <p>And ran the </p>
  
  <blockquote>
    <p>test.py | dot -Tpng -otree.png</p>
  </blockquote>
  
  <p><a href="https://imgur.com/G2Wug7U" rel="noreferrer"><img src="https://imgur.com/G2Wug7U" alt="GraphViz"></a></p>