*import graph_tool as gt
netCoex = gt.Graph() *#create a network * coeff_prop = netCoex.new_edge_property("float") *# create a network edge property *pvals_prop = netCoex.new_edge_property("float")*
*netCoex.edge_properties['coeff'] = coeff_prop netCoex.edge_properties['pvals'] = pvals_prop*
*var = [['a','b','c','d','e'],['b','c','a','e','b'],[0.33,0.55,0.76,0.87,0.55],[0.12,0.012,0.004,0.0021,0.03]]
dfConet = pd.DataFrame({ 'Node1' : var[0], 'Node2' : var[1],'PearCoeff' : var[2], 'PVal' : var[3]})*
# Because you have two extra columns in the dataframe so you must pass two lists to the eprops argument
#Also for two properties it adds property values in reverse order. Why this is the problem ? # I defined coeff_prop first and pvals_prop later. But it doesn't reads the columns in this order.
#So variable added first (coeff_prop) is # assigned the last column and vice versa for the other variable pvals_prop
*coeffProp = netCoex.add_edge_list(dfConet.values.tolist(),hashed=True, string_vals=True,eprops=[pvals_prop,coeff_prop])*
-- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/