Rows and values
filter
Keeps the rows an expression is true for.
filter: heat > threshold and community != "Kentron"
formula
Adds or replaces columns. They are computed in the order written, so one can use the one before it.
formula:
flat_price: price_m2 * area_m2
years_of_salary: flat_price / (wage * 12 * net_share)
aggregate
Summarises groups of rows: by names the columns that make a group, and
every other key is a new column computed with an
aggregate function.
aggregate:
by: [code, community]
heat: median(lst_c)
hot_share: share(lst_c > 45)
days: count()
resample
Changes the time step of each series: one row per period.
resample: { to: year, how: mean }
resample: { to: month, how: { rain: sum, temp: mean }, by: [code] }
| Option | Meaning |
|---|---|
to | year, quarter, month, week, day or season. |
how | mean (default), median, sum, min, max, first, last or count; or a mapping per column. |
by | Extra columns that keep groups apart. |
The table needs a time column.
unpivot
Turns columns into rows.
unpivot: { keep: [time, code], name: variable, value: value, columns: [ndvi, rain] }
| Option | Meaning |
|---|---|
keep | Columns every new row keeps (required). |
name | The column holding the old column names (default column). |
value | The column holding the values (default value). |
columns | The columns to turn into rows; by default every metric column. |
score
A weighted composite score: each weighted column becomes a percentile rank
(reversed for a negative weight), and score is their weighted mean, from 0
to 100. Adds score and rank (1 is best).
score:
weights: { heat: 2, green_share: -1, elderly: w_elderly }
per: [district]
top: 5
| Option | Meaning |
|---|---|
weights | column: weight; a weight may be a parameter; a negative weight favours low values. |
per | Rank within these groups. |
top | Keep this many best rows per group. |
sort
Orders rows by columns; -column sorts descending.
sort: [-score, name]
limit
Keeps the first rows. The number may be a parameter.
limit: 20
correlate
Correlates two columns, optionally per group. The result has the by
columns, n, r and method.
correlate: { x: temp, y: pm25, method: spearman, by: [station] }
method is pearson (default) or spearman.
holdout
Checks whether a ranking holds in a later period: ranks what by names by
value on the rows test is false for, and again on the rows it is true
for, and compares them.
check:
holdout: { from: cells, test: year == 2025, by: code, value: heat, top_share: 0.2 }
The result has units, train_rows, test_rows, rank_correlation,
top_precision, top_jaccard and top_share.