Initializing playground…
← Back to roadmap

Series.map()

Map values using a function, Record, Series, or ES6 Map — mirrors pandas.Series.map.

1 — Function mapper

Apply a function (value, index, pos) => U to every element.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

2 — Record / dict mapper

Look up each value (stringified) in a plain JS object. Missing keys produce null.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

3 — Series mapper

Look up each value by label in another Series. Missing labels produce null.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

4 — ES6 Map mapper

Use a native Map<Scalar, U> for non-string keys (numbers, booleans, null, etc.).

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

5 — naAction: "ignore"

Pass { naAction: "ignore" } to preserve existing null/NaN values without looking them up.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent