howto add a fixed number to id column to make them unique [closed]

asked 2013-08-30 20:30:39 +0100

miromarchi gravatar image

updated 2013-08-30 20:31:05 +0100

I have a data table of a network, in this format: [source id, target id]. e.g.:

1, 2
2, 3
...

source are users and targets are groups

A program like Gephi.org is capable of drowing a graph from this data.

the problem with my data is that the sources (users) ids are from a db_table, and the targets (groups) ids from another db_table, and they are not unique. Basically when I have

1,1

it means [userid1, group id1] and NOT [userid1, userid1]

The program (gephi) doesn't understand I have two different types of nodes in my network (from this data).

I thought to change all groups ids from hundreds to 10thousands, e.g:

1 → 10001, 12 → 10012

and so on. This way the program can distinguish the two.

Is this a good practise? Any simple way to do it in the entire group_id column? Thanks guys miro

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-10-04 22:23:56.025210

Comments

1

Seems you have a CSV file, you can open it with calc, easily change values in one column with Paste special.

Open the CSV file setting the appropiate options in the import window.
in a cell out of data range enter 10000
Copy the cell Ctrl+C
Select the data id to modify, go to first data id cell, Ctrl+Shift+down arrow.
Menu/edit/paste special/Operation add - Ok.
Delete cell with pasted value.
Save the CSV file.

m.a.riosv gravatar imagem.a.riosv ( 2013-08-30 23:32:15 +0100 )edit

Thanks, it worked!

miromarchi gravatar imagemiromarchi ( 2013-09-02 16:09:07 +0100 )edit