I have a large dataframe(df) with Weight ,Source Node, target columns.
| SourceNode | target | Weight |
|---|---|---|
| 176890 | 657826 | 201 |
| 136578 | 589231 | 300 |
| 143873 | 457139 | 50 |
| 134589 | 892147 | 550 |
| 198345 | 678931 | 350 |
| 112443 | 525188 | 600 |
| 336128 | 689313 | 1500 |
Source node and target column are object and weight is int data type. I am trying to create a network graph which shows the connectivity from source node to target column (unidirect) and the edge need to reflect the weight value( like by stronger bigger connection). This is the code I am using I am getting error not showing anything for me.
import networkx as nx
G= nx.from_pandas_edgelist(df_new, source = 'SourceNode', target='target' , edge_attr= 'Weight')
I error when Ia m trying this code.. I am very new to visualization in pandas. I appreciate any help.


networkxpackage, try runningpip show networkxto check