getting a subset of node ids from tables #2289
-
Hi everyone, maybe a silly question here, but is there a more efficient way of getting the node ids of some subset from the tables than doing this?
Which I find a bit cumbersome to write and often forget taking the first element at the end. I get the following is not possible as there is no stable id column:
But why? Why are ids changing when subsetting, and not a "real" column? Thanks a lot |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @alxsimon, thanks for the question. |
Beta Was this translation helpful? Give feedback.
-
You can always use |
Beta Was this translation helpful? Give feedback.
Hi @alxsimon, thanks for the question.
The
id
of a row in tskit is just its index in the table, so they will change when you take a subset of the table. This saves storing an extra field in each table and also saves thorny id collision issues when manipulating tables. IDs aren't needed as you can use techniques such as your first example.