Skip to content

polars/polars-expr-mask-precedence

Rule polars-expr-mask-precedence
Pack Polars
Severity error
Fix unsafe, with xpd check --fix --unsafe-fixes
Library versions every version

Polars 2.1.0 raises TypeError for this unparenthesized mask. Enclose each comparison in parentheses before combining it.

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

TypeError from chained comparison truth testing.

Use xpd check --fix --unsafe-fixes to parenthesize each comparison around &, |, or ^.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

Polars 2.1.0 raises TypeError for this unparenthesized mask. Enclose each comparison in parentheses before combining it.

Browse the other rules of the Polars pack.