[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 583: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 639: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4516: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3262)
Gephi forums •[SOLVED] Id, Source and Target not recognized importing csv
Page 1 of 1

[SOLVED] Id, Source and Target not recognized importing csv

Posted: 01 Jun 2013 16:21
by luis_r_izquierdo
Hi There,

This is not a question, but –I believe– a SOLVED issue. The problem reported below made me go crazy for the last couple of days, and it would be great if only one person goes insane due to csv importing issues.

PROBLEM:

The problem I had is that, when importing a csv file with the labels “Id” and “Label” (if nodes table), or “Source” and “Target” (if edges table), Gephi did not understand these labels.

In the case of nodes, Gephi would load the file but would not recognize my Ids; thus, it would create new Ids, ignoring mine, and this would result in two distinct columns, one with its Ids, and one with mine, but both named “Id”.

In the case of edges, Gephi would not import my edges. The strange complain Gephi issued was “Edges table needs a ‘Source’ and ‘Target’ column with nodes ids”. I say strange because, at the same time I was reading this error message, I would see the two columns named ‘Source’ and ‘Target’ in the file preview (given by Gephi).

EXPLANATION AND SOLUTION:

It turns out that some file formats (like UTF-8) sometimes have a so-called BOM character (see http://en.wikipedia.org/wiki/Byte_order_mark) at the start of the text stream, which I cannot see, not even with pretty low-level text editors like Crimson Editor –let alone word pad, notepad or excel.

Anyway, if you’re experiencing the problems I describe above, it could be because your text file has this hidden BOM character. If so, you can open it with (free) Crimson Editor, go to Document -> Encoding Type, and change it to UTF-8 (w/o BOM). The program will NOT understand this as a change, so save the file again, even if the green icon stays green (indicating no changes have been made). With this new file, everything went fine for me.

I attach examples.

That’s all, and thank you so much, Gephi developers for such a nice piece of software (no sarcasm implied at all!!!!).
Luis

Re: “Id”, “Source” and “Target” not recognized importing csv

Posted: 01 Jun 2013 16:44
by admin
Thanks!

You can also use Notepad++ to change the format from UTF-8 to UTF-8 with BOM.

Notice that for XML encoded files like GEXF, you _need_ BOM.

Re: [SOLVED] Id, Source and Target not recognized importing csv

Posted: 30 Aug 2017 17:19
by sweaver
This solution worked for me - thanks so much for posting this issue and the fix! Realize it was years ago, but you definitely saved me time and energy - so, mission accomplished :)