title: NetworkX - Setting node attributes from dataframe
body: <p>I'm having trouble figuring out how to add attributes to nodes in my network from columns in my dataframe. </p>
  
  <p>I have provided an example of my dataframe below, there are around 10 columns in total, but I only use the 5 columns shown below when creating my network. </p>
  
  <p>Unfortunately at the moment I can only get edge attributes working with my network, I am doing this as shown below:</p>
  
  <pre><code>g = nx.from_pandas_dataframe(df, 'node_from', 'node_to', edge_attr=['attribute1','attribute2','attribute3'])
  </code></pre>
  
  <p>The network will be a directed network. The attributes shown in the below dataframe are the attributes for the 'node_from' nodes. The 'node_to' nodes sometimes appear as 'node_from' nodes. All the nodes that can possibly be shown in the network and their respective attributes are shown in the df_attributes_only table.</p>
  
  <p>df_relationship:</p>
  
  <pre><code>node_from:  node_to: ........ attribute1:   attribute2:   attribute3:
      jim      john    ........    tall          red             fat
      ...
  </code></pre>
  
  <p>All of the columns have words as their values, not digits. </p>
  
  <p>I also have another dataframe which has each possible node and their attributes:</p>
  
  <p>df_attributes_only:</p>
  
  <pre><code>id:   attribute1:   attribute2:     attribute3:
  jim      tall          red             fat
  john     small         blue            fat
  ...
  </code></pre>
  
  <p>I essentially need to assign the above three attributes to their respective id, so every node has their 3 attributes attached. </p>
  
  <p>Any help on how I could get node attributes working with my network is greatly appreciated. </p>