Why does networkx not read my csv dataset file opened with pd.read_csv using nx.read function?

41 Views Asked by At
import pandas as pd

df = pd.read_csv("/Users/leokarl/Downloads/a2 (1).csv")

import networkx as nx

G = nx.read_weighted_edgelist(df)

It prints the error:

Edge data ['ID1;ID2;%', 'in', 'ID2;number', 'identical', 'lines'] and data_keys (('weight', <class 'float'>),) are not the same length

If I use G = nx.read_edgelist(df) it prints out the error:

Failed to convert edge data (['ID1;ID2;%', 'in', 'ID2;number', 'identical', 'lines']) to dictionary

0

There are 0 best solutions below