Gather / List Layer

Create sublists by selecting multiple indices from each list. Similar to Polars' list.gather() or NumPy's fancy indexing. Returns a list column containing elements at specified positions from each input list. Supports negative indices for reverse indexing.

Example transformation:

listsindicesresult
[3, 2, 1][0, 2][3, 1]
[1, 2, 3, 4, 5][0, 4][1, 5]
[][0, 1][null, null]
[10][-1][10]

Common applications:

  • Extracting specific positions from time series
  • Selecting key elements from sequences
  • Sampling data at specific indices
  • Creating feature subsets
  • Reordering list elements
  • Pattern matching at specific positions

Note: Out-of-bounds indices produce null values. Negative indices count from the end (-1 for last element). Empty lists return nulls for all requested indices.

Table
0
0
Table

Select

column

The source list column to gather from. Examples:

  • Time series: [val1, val2, val3, val4]
  • Sequences: [first, second, third, fourth]
  • Measurements: [1.1, 1.2, 1.3, 1.4] Lists can have different lengths

Indices

oneof
FixedIndices

Fixed

[i32, ...]
0, -1

List of indices to gather from each list. Examples:

  • [0, -1]: First and last elements
  • [0, 2, 4]: Elements at positions 0, 2, and 4
  • [-2, -1]: Last two elements Negative indices count from end of list

Column containing lists of indices to gather. Each row can have different indices. Example: If column contains [0, 2], [1, -1], each row will gather different positions

Name for the new column. If not provided, the system generates a unique name. If AsColumn matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.