map

map(x, callback)

map(x, y, ..., callback)

Try it yourself:

See also:

map(): Applying a Function to Each Value

map() applies a function or expression to every entry in a collection, returning a transformed collection of the same general shape. It is useful for conversions, cleanup, and element-by-element mathematical transformations.

Element-wise intent

For example, map can square each entry or convert every measurement. Use dotPow() when a standard element-wise power is enough, and dotMultiply() for matching weights. map is clearer when the per-entry logic is custom.

Ensure the mapping operation accepts every possible entry, including zero, negative, or missing-like values. Use filter() first to remove unsuitable entries, and verify output shape with size().

All functions