Open Wainberg opened 9 months ago
Coercion to string causes issues beyond just addition: for instance, this error message incorrectly says the types are str
and str
rather than int
and str
(or should it say Int64
and String
?):
>>> pl.DataFrame({'a': [1, 2, 3]}) * pl.DataFrame({'a': ['1', '2', '3']})
thread '<unnamed>' panicked at crates/polars-core/src/series/arithmetic/borrowed.rs:470:44:
data types don't match: InvalidOperation(ErrString("mul operation not supported for dtypes `str` and `str`"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "polars/dataframe/frame.py", line 1534, in __mul__
return self._from_pydf(self._df.mul_df(other._df))
^^^^^^^^^^^^^^^^^^^^^^^^^^
pyo3_runtime.PanicException: data types don't match: InvalidOperation(ErrString("mul operation not supported for dtypes `str` and `str`"))
Checks
Reproducible example
Issue description
DataFrame and Series addition coerces non-String columns to String.
Expected behavior
All of these should give an error.
Installed versions