title: Python: how to create a dictionary from a pandas dataframe?
body: <p>I want to perform personlized pagerank (ppr) in python using <code>networkx</code> as explained <a href="https://stackoverflow.com/questions/43196867/using-pythons-networkx-to-compute-personalized-page-rank">here</a></p>
  
  <p>I have a dataframe that contains the edgelist between two nodes <code>i</code> and <code>j</code></p>
  
  <pre><code>df
       i     j
  0    A     B
  1    B     C
  2    B     A
  3    C     A
  4    C     B
  </code></pre>
  
  <p>and for each node I have a label <code>0</code> or <code>1</code>. </p>
  
  <pre><code>dfN 
        Node  Label
  0      A     0
  1      B     1
  2      C     0
  </code></pre>
  
  <p>I created the network</p>
  
  <pre><code>import networkx as nx
  g = nx.from_pandas_edgelist(df, 'A', 'B')
  </code></pre>
  
  <p>Now I want to run the ppr</p>
  
  <pre><code>ppr1 = nx.pagerank(g,personalization={A:0, B:1, C:0})
  </code></pre>
  
  <p>How can I create the <code>dict</code> <code>{A:0, B:1, C:0}</code> directly from <code>dfN</code>?</p>