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])What the rule reports
Section titled “What the rule reports”InvalidOperationError for two Series. A string Series plus integer scalar raised TypeError.
How to fix it
Section titled “How to fix it”Edit the code using the replacement in the example.
Diagnostic message
Section titled “Diagnostic message”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.