Skip to content

polars/polars-map-elements-native

Pack Severity Fix Versions
Polars warning unsafe, with xpd check --fix --unsafe-fixes All versions

Polars 2.1.0 emits PolarsInefficientMapWarning when map_elements wraps addition in this lambda. Add the value directly with a Polars expression.

expr.map_elements(lambda value: value + 1, return_dtype=pl.Int64)
expr + 1

PolarsInefficientMapWarning under -W error.

Use xpd check --fix --unsafe-fixes to replace the map_elements addition lambda with direct expression addition.

Polars 2.1.0 emits PolarsInefficientMapWarning when map_elements wraps addition in this lambda. Add the value directly with a Polars expression.

See all rules in the Polars pack.