Ciaren

Limit rows — limitRows

Keep a slice of rows.

Use cases

  • Take the top N after a Sort (e.g. top 100 customers).
  • Page through data with offset + n.
  • Trim a preview to a manageable size.

What it does

Returns the first n rows from the current row order. Combine with Sort rows before limiting to get a meaningful "top N".

Limit rows (n=3)
Before
regionamount
South150
West120
North80
East30
Central10
5 rows · 2 cols
After
regionamount
South150
West120
North80
3 rows · 2 cols

Configuration

Config keyTypeRequiredDescription
nintYesNumber of rows to keep (≥ 0; 0 keeps no rows)
offsetintNoSkip this many rows first (default 0)

Generated Python code

This example keeps the first three rows in the current order (n: 3, default offset: 0). It does not sort them.

pandas

python
df_2 = df_1.head(3)

Polars

python
df_2 = df_1.head(3)

Tips & common mistakes

  • Limit is positional, not random — sort first for a meaningful "top N". For a random subset use Sample rows.
  • offset skips from the current row order, so combine it with a deterministic Sort for stable paging.

See also