Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Transform networkx graph to dataframe

# Get G egdes to dataframe
edge_df = nx.to_pandas_edgelist(G) 

# Transform networkx nodes to dataframe
nodelist = list(G.nodes(data=True)) # From G to list
node_df = pd.DataFrame(nodelist, columns=['vertex', 'name_attribute']) # From list to DF
Source by networkx.org #
 
PREVIOUS NEXT
Tagged: #Transform #networkx #graph #dataframe
ADD COMMENT
Topic
Name
4+6 =