Exporting GEXF from Python networkx: label problem

Get help with your data
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
rjalex
Posts:15
Joined:06 Jan 2013 13:26
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Exporting GEXF from Python networkx: label problem

Post by rjalex » 06 Nov 2021 18:45

Dear friends,
I am building a graph with python's networkx library and then writing it out with tne nx.write_gexf(G, filename) function.

The graph is a multigraph with the nodes being authors and an edge added each time it coauthors with someone else.

Upon importing all goes well, I simply SUM the edges if there are more than one between two nodes and all the date is to be found in the data laboratory but I find that the Label column is empty and there is ANOTHER Label column added with the names.

This is how I iterate through my authors (pis) dataframe and build the nodes:

for index, row in pis.iterrows():
G.add_node(row['scid'], Label=row['name'], hindex=row['hindex'], lastyear=row['recentyear'], cits=row['cits'], role='PI', affil="IIT")

What am I doing wrong? Can't I directly have the labels filled for me?

The solution right now is manual: use the copy from another column and copy the "Label" column in the real Label column but it is a bit cumbersome.

Thanks a lot.

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable