polars/polars-builtin-on-expr-or-series
| Rule | polars-builtin-on-expr-or-series |
|---|---|
| Pack | Polars |
| Severity | error |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | every version |
Polars 2.1.0 raises TypeError when this Python builtin tries to size or iterate an Expr. Use the corresponding expression method.
len(expr)expr.len()What the rule reports
Section titled “What the rule reports”Five TypeError results on Expr. All five builtins worked on Series.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to replace the Python builtin with the matching Polars expression method.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
Polars 2.1.0 raises TypeError when this Python builtin tries to size or iterate an Expr. Use the corresponding expression method.Browse the other rules of the Polars pack.