Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: python open all files of type csv 
Python :: python get the last element from the list 
Python :: django python base 64 decode 
Python :: wintp python manage.py createsuperuser 
Python :: lambda python 
Python :: data structures and algorithms in python 
Python :: merge dataframe pandas 
Python :: print 2 decimal places python 
Python :: python stack 
Python :: set type of column pandas 
Python :: python list elements 
Python :: how to use cv2.COLOR_BGR2GRAY 
Python :: relative path django 
Python :: python one line if statement without else 
Python :: python spammer 
Python :: pandas check match string lowercase 
Python :: set column datatype pandas 
Python :: python dictionary get 
Python :: groupby and sort python 
Python :: python factorial 
Python :: python - subset dataframe based on unique value of a clumn 
Python :: matplotlib show plot 
Python :: throw error in python 
Python :: how to access dataframe row by datetime index 
Python :: replace outliers with nan python 
Python :: how to change case of string in python 
Python :: random 0 or 1 python 
Python :: if main 
Python :: turn list in to word python 
Python :: django tempalte tag datetime to timestamp 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =