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

Get help with your data
Post Reply
luis_r_izquierdo
Posts: 4
Joined: 26 May 2013 18:25

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

Post by luis_r_izquierdo » 01 Jun 2013 16:21

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
Attachments
nodes-wBOM.csv
(89 Bytes) Downloaded 403 times
nodes-woBOM.csv
(86 Bytes) Downloaded 225 times
links-woBOM.csv
(134 Bytes) Downloaded 298 times
links-wBOM.csv
(137 Bytes) Downloaded 196 times

admin
Gephi Community Manager
Posts: 964
Joined: 09 Dec 2009 14:41

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

Post by admin » 01 Jun 2013 16:44

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.

sweaver
Posts: 1
Joined: 30 Aug 2017 17:13

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

Post by sweaver » 30 Aug 2017 17:19

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 :)

Post Reply