WORKAROUND: First field not recognized in .csv import

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
bellhalla
Posts:1
Joined:26 Dec 2016 17:09
[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
WORKAROUND: First field not recognized in .csv import

Post by bellhalla » 26 Dec 2016 21:18

I was trying to import a .csv node list (a task I had successfully done in the past), but Gephi would not recognizing my id field, which was the first field for each record. It would generate its own node IDs and import my id field as an additional column of string data. I tried changing the header to ‘ID’, ‘Id’, and ‘id’ in case that would work. (It didn’t.) I tried using older files that had worked in the past. I also exported the node table from the Les Miserables sample and pasted my data in, leaving the headers untouched. None of those would work. I tried re-arranging the fields before generating the .csv file so that the ‘label’ field was first. On that try the id field was accepted but the label field was ignored and imported as an additional string field.

Taking that as a clue, what I eventually found was by putting a fake data column at the beginning, and unchecking the box to import the field, it would recognize both the id and label fields and import them properly.

I am using Excel and UTF-8 .csv files. I did examine them in a text editor to ensure there was no funny business at the beginning of the file. This is a new-to-me behavior, so I wanted to post the problem and my solution in hopes the import issue might be fixed and/or so that someone encountering the same problem wouldn’t be stuck like I was.

User avatar
eduramiba
Gephi Code Manager
Posts:1064
Joined:22 Mar 2010 15:30
Location:Madrid, Spain
[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

Re: WORKAROUND: First field not recognized in .csv import

Post by eduramiba » 26 Dec 2016 21:36

Hi,
I have seen this happen when the first bytes of the file are the UTF-8 BOM, so characters are not shown in Gephi UI but are being read and included in the column name, and it's not detected as the existing Id column.

Can you create a github issue about this?

gulbransen
Posts:1
Joined:30 Jan 2017 03:06
[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

Re: WORKAROUND: First field not recognized in .csv import

Post by gulbransen » 30 Jan 2017 03:48

Thank you SOO much Bellhalla. Awkward workaround solved it!

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