Skip to content

Polars

The Polars pack catches removed Polars 2.0 APIs, expression and null bugs, eager reads that defeat lazy pushdown, and Python loops over rows on files that import polars. Version-gated rules check the installed Polars release in the project's virtual environment.

Rules Safe fix Unsafe fix Manual fix
35 2 20 13
Rule Severity Fix What it finds
removed-in-polars error unsafe Polars 2.0 removed methods and attributes that previously worked.
polars-removed-parameter error unsafe Polars 2.0 removed several keyword arguments.
deprecated-in-polars warning safe Polars 2.1.0 warns about older binning methods and redundant horizontal concatenation arguments.
Rule Severity Fix What it finds
polars-silent-dtype-coercion warning none Use a strict Polars cast so invalid values raise instead of becoming nulls.
polars-streaming-order info none Polars 2.0 made streaming the default for lazy queries.
polars-removed-cast error unsafe Polars 2.0 removed several casts that need an explicit conversion.
polars-selector-coercion info unsafe A selector combined with col by &, | or ^ becomes a value expression in Polars 2.1.0.
polars-mixed-dtype-arithmetic error none Polars 2.1.0 rejects string and numeric Series arithmetic.
polars-null-comparison warning unsafe Polars 2.1.0 emits UserWarning for comparison to None.
polars-expr-boolean-op error unsafe Polars 2.1.0 raises TypeError when a Python boolean operator tests a Polars expression or Series.
polars-expr-mask-precedence error unsafe Polars 2.1.0 raises TypeError for this unparenthesized mask.
polars-when-without-otherwise info unsafe Polars returns null for unmatched rows when then has no otherwise.
polars-dataframe-orient info none Nested list data can fit both DataFrame orientations.
polars-list-get-oob info unsafe Polars raises ComputeError for an out-of-bounds list offset by default.
Rule Severity Fix What it finds
polars-eager-read-before-query info unsafe Start this lazy query with a scan to enable projection and predicate pushdown.
polars-collect-then-lazy info unsafe Collect executes this query before lazy starts a new plan.
polars-collect-then-write info unsafe Collect builds a DataFrame before writing.
polars-collect-in-loop info none Collect inside a loop can execute a separate query on each iteration.
polars-lazy-schema-property warning safe Polars 2.1.0 emits PerformanceWarning when code reads LazyFrame.schema.
Rule Severity Fix What it finds
polars-map-elements-native warning unsafe Polars 2.1.0 emits PolarsInefficientMapWarning when map_elements wraps addition in this lambda.
polars-map-without-return-dtype info none Polars may fail to infer the result type of a Python function.
polars-row-iteration info none Use a Polars expression to compute a reduction over rows.
polars-sequential-with-columns info unsafe Chained with_columns calls may split work into separate steps.
polars-concat-in-loop info none Concatenating into the same frame on every iteration repeatedly grows the result.
polars-groupby-join-over info none A join to an aggregation of the same Polars frame can often be written as a window expression.
polars-sort-then-head info unsafe For a small number of rows, top_k or bottom_k can avoid a full sort.
polars-pandas-api-name error unsafe Polars frames expose a different API from pandas.
polars-pandas-round-trip info unsafe A Polars to pandas to Polars round trip converts the data twice.
polars-builtin-on-expr-or-series error unsafe Polars 2.1.0 raises TypeError when this Python builtin tries to size or iterate an Expr.
polars-row-lag-on-time-series warning none Row-counted .shift(n), .diff(n), .pct_change(n), and .rolling_mean(n) / .rolling_sum(n) expressions on a Polars time series count rows rather than elapsed calendar time.
Rule Severity Fix What it finds
polars-join-without-validate info none A Polars join allows duplicate keys on either side by default.
polars-join-asof-unsorted info unsafe An as-of join needs ascending join keys.
polars-categorical-vs-enum info none Categorical accepts every string label.
polars-sql-frame-globals info none Polars sql resolves table names from Python globals.
polars-assert-frame-equals warning unsafe Polars DataFrame.equals returned True on equal values with Int32 and Int64 columns.