Python Forum
Networkx / Data Science
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Networkx / Data Science

i need your help with a project. I want to use Networkx to analyze relationships between data. For a first test I have the following database:

Document "node.csv" which includes the names for a Company, for example:

And Document "edges.csv" which includes the Connections for a Company, for example:

Company, Employee
A, Max
B, John
C, Frank

With the following code I get the connection between the employees and the company:

with open('node.csv', 'r') as nodecsv:
    nodereader = csv.reader(nodecsv)
    nodes = [n for n in nodereader][1:]

node_names = [n[0] for n in nodes]

with open('edges.csv', 'r') as edgecsv:
    edgereader = csv.reader(edgecsv)
    edges = [tuple(e) for e in edgereader][1:]


nx.draw(G, with_labels = True, edge_color = 'g')
But my problem is that I have several employees at the company. If I now add more employees in Excel, I get the following error message in Python:

ValueError: dictionary update sequence element #0 has length 1; 2 is required

The Excel list should look like this:

Company, Employee
A, Max, Anna, Jennifer
B, John
C, Frank, Michael

Many thanks in advance!

Possibly Related Threads…
Thread Author Replies Views Last Post
  What good book in Data science ? bashar 0 362 Apr-14-2020, 03:29 AM
Last Post: bashar
  WGET + Data Science + Python Programs BrandonKastning 0 278 Mar-29-2020, 06:43 PM
Last Post: BrandonKastning
  Data science with Python - links with exercises darpInd 1 431 Mar-02-2020, 04:24 PM
Last Post: Larz60+
  Softwares to learn data science jk91 2 467 Feb-26-2020, 07:17 PM
Last Post: jefsummers
  Data Science Project DaisyPJ 3 553 Jan-19-2020, 07:05 PM
Last Post: jefsummers
  Nvidia or (25% better for the price) Radeon GPU for Python Data Science gheek 0 344 Dec-11-2019, 05:19 PM
Last Post: gheek
  networkx to show traffic help to get started paul41 0 352 Nov-23-2019, 05:19 PM
Last Post: paul41
  data science peepeepoopoo 1 543 Sep-21-2019, 10:34 PM
Last Post: Larz60+
  Python for Enterprise Data Science paripy 3 810 May-03-2019, 05:37 AM
Last Post: directnirvana

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020