TakeEvery / Manipulation Layer
Select rows at regular intervals (every nth row) starting from a specified position. Similar to pandas' df.iloc[start::n] or R's seq(start, nrow(df), by=n).
Example with start=0, n=2 (every 2nd row):
Original DataFrame:
| Index | Value |
|---|---|
| 0 | A |
| 1 | B |
| 2 | C |
| 3 | D |
| 4 | E |
| 5 | F |
After take_every(start=0, n=2):
| Index | Value |
|---|---|
| 0 | A |
| 2 | C |
| 4 | E |
Common applications:
- Data downsampling
- Regular interval sampling
- Time series decimation
- Periodic snapshot analysis
- Systematic observation selection
- Load reduction
- Pattern frequency analysis
- Regular data thinning
Note: Selection pattern is deterministic and regular, useful for systematic sampling.
Table
0
0
Table
StartIndex
i64Starting position for selection (zero-based). Common patterns:
- 0: Start from beginning (most common)
- 1: Skip first row
- n: Skip first n rows
- -n: Start n rows from end Controls phase of selection pattern
NEvery
u64Interval between selected rows. Common uses:
- 2: Every other row (50% reduction)
- 7: Weekly samples from daily data
- 24: Daily samples from hourly data
- 10: Decimal reduction
- 100: Percentage point sampling