GatherEvery / List Layer
Create sublists by selecting every nth element starting from a specified offset. Similar to Polars' list.gather_every(). Returns a list column containing regularly spaced elements from each input list.
Example transformation:
lists | n | offset | result |
---|---|---|---|
[1, 2, 3, 4, 5] | 2 | 0 | [1, 3, 5] |
[6, 7, 8] | 1 | 1 | [7, 8] |
[9, 10, 11, 12] | 3 | 0 | [9, 12] |
[] | 2 | 0 | [] |
Common applications:
- Downsampling time series data
- Regular sampling from sequences
- Creating strided subsequences
- Periodic data extraction
- Pattern analysis at regular intervals
Note: If n or offset is larger than list length, returns empty list. Supports both fixed values and column references for n and offset.
Select
columnThe source list column to gather from. Examples:
- Time series: [t1, t2, t3, t4, t5]
- Measurements: [m1, m2, m3, m4]
- Sequences: [a, b, c, d, e, f] Lists can have different lengths
NthElement
oneofFixedN
u32Take every nth element. Examples:
- 1: Take every element
- 2: Take every second element
- 3: Take every third element Must be greater than 0
SelectN
columnColumn containing n values. Each row can have different sampling intervals
Offset
oneofFixedOffset
u32Starting position for gathering. Examples:
- 0: Start from first element
- 1: Start from second element
- 2: Start from third element
SelectOffset
columnColumn containing offset values. Each row can have different starting positions
AsColumn
nameName 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.