Skip to content

polars/polars-expr-boolean-op

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

Polars 2.1.0 raises TypeError when a Python boolean operator tests a Polars expression or Series. Use parenthesized masks with &, | or ~.

(expr > 0) and (expr < 5)
(expr > 0) & (expr < 5)

TypeError from ambiguous truth value.

Use xpd check --fix --unsafe-fixes to replace and, or, and not with &, |, and ~.

Polars 2.1.0 raises TypeError when a Python boolean operator tests a Polars expression or Series. Use parenthesized masks with &, | or ~.

See all rules in the Polars pack.