# Rescale a number column

Shape / columns

normalise, standardise, z-score, min-max, log transform

Page: <https://meridian.online/operations/rescale-a-number-column>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

z-score and min-max

It reads the `orders` table the proofs share. Create it first:

```sql
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);
```

Then run the statement:

```sql
CREATE TEMP TABLE result AS
SELECT order_id, amount,
       (amount - avg(amount) OVER ()) / stddev_samp(amount) OVER () AS z,
       (amount - min(amount) OVER ()) / (max(amount) OVER () - min(amount) OVER ()) AS minmax
FROM orders WHERE amount IS NOT NULL;
SELECT order_id, amount, round(z, 3) AS z, round(minmax, 3) AS minmax FROM result;
SELECT CASE WHEN ((SELECT abs(avg(z)) < 1e-9 AND abs(stddev_samp(z) - 1) < 1e-9 AND min(minmax) = 0 AND max(minmax) = 1 FROM result)) THEN 'as expected' ELSE error('z does not have mean 0 and deviation 1, or min-max does not span 0 to 1') END AS verdict;
```

It needs nothing installed beyond DuckDB itself.

## Variants

- Apply a log or power transform: Apply a logarithm or a Box-Cox or Yeo-Johnson transform to make a column less skewed.
- Apply a saved scaling: Rescale a new table with the parameters learnt from an earlier scaling.
- Rescale by z-score or range: Rescale numeric columns to zero mean and unit variance, a chosen range, or another linear scheme.
- Reverse a scaling: Map scaled values back to their original range.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).

- Duckle: [`Z-Score`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- KNIME Analytics Platform: [`Denormalizer`](https://api.hub.knime.com/nodes/*XSCKH1I1S2QiA5_-?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Denormalizer (PMML)`](https://api.hub.knime.com/nodes/*Zb0h4FutoU0ajxTb?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Normalizer`](https://api.hub.knime.com/nodes/*7isNz6mji9l5c7Iv?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Normalizer (Apply)`](https://api.hub.knime.com/nodes/*3KRhzbnT8pKx6c6H?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Normalizer (PMML)`](https://api.hub.knime.com/nodes/*RN6KF9CVXWAd5A3J?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Normalizer Apply (PMML)`](https://api.hub.knime.com/nodes/*3pyoApJaU-yz2QMp?details=full) (read 2026-09-27)
- mlpack: [`mlpack_preprocess_scale`](https://www.mlpack.org/doc/user/bindings/cli.html) (read 2026-09-27)
- RapidMiner Studio: [`De-Normalize`](https://docs.rapidminer.com/latest/studio/operators/cleansing/normalization/denormalize.html) (read 2026-09-27)
- RapidMiner Studio: [`Generate Power Transform`](https://docs.rapidminer.com/latest/studio/operators/extensions/Operator%20Toolbox/blending/attribute_generation/generate_power_transform.html) (read 2026-09-27)
- RapidMiner Studio: [`Logarithm`](https://docs.rapidminer.com/latest/studio/operators/modeling/time_series/transformation/logarithm.html) (read 2026-09-27)
- RapidMiner Studio: [`Normalize`](https://docs.rapidminer.com/latest/studio/operators/cleansing/normalization/normalize.html) (read 2026-09-27)
- RapidMiner Studio: [`Normalize (Series)`](https://docs.rapidminer.com/latest/studio/operators/modeling/time_series/transformation/normalization.html) (read 2026-09-27)
- RapidMiner Studio: [`Scale by Weights`](https://docs.rapidminer.com/latest/studio/operators/cleansing/normalization/scale_by_weights.html) (read 2026-09-27)
- Trifacta: [`Scale to mean`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
- Trifacta: [`Scale to min max`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
