Skip to content

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()

Five TypeError results on Expr. All five builtins worked on Series.

Use xpd check --fix --unsafe-fixes to replace the Python builtin with the matching Polars expression method.

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.