traveler.digitize#

traveler.digitize(parent_ids, child_ids)[source]#

Digitize child IDs based on their positions in the parent IDs.

For example, the parent_ids could be the household ids column from the households table, and the child_ids could be the household ids column from the persons table. The result would be an array, of size matching the persons table, where each element is the position of the corresponding household in the households table. If a household id is not found in the households table, the position will be -1.

Parameters:
  • parent_ids (array-like) – An array of parent IDs (e.g., household IDs).

  • child_ids (array-like) – An array of child IDs (e.g., household IDs from a different table).

Returns:

An array of positions where each position corresponds to the index of the child ID in the parent IDs. If a child ID is not found in the parent IDs, its position will be -1.

Return type:

jnp.ndarray