Skip to content

polars/polars-mixed-dtype-arithmetic

Pack Severity Fix Versions
Polars error none, edit by hand Polars 2.1+

Polars 2.1.0 rejects string and numeric Series arithmetic. Cast the strings explicitly, or use string concatenation for text.

pl.Series(["1"]) + pl.Series([2])
pl.Series(["1"]).cast(pl.Int64) + pl.Series([2])

InvalidOperationError for two Series. A string Series plus integer scalar raised TypeError.

Edit the code using the replacement in the example.

Polars 2.1.0 rejects string and numeric Series arithmetic. Cast the strings explicitly, or use string concatenation for text.

See all rules in the Polars pack.