Inconsistent implicit type casting when using max_horizontal
and mean_horizontal
#15951
Closed
2 tasks done
Labels
bug
Something isn't working
needs triage
Awaiting prioritization by a maintainer
python
Related to Python Polars
Checks
Reproducible example
Log output
Issue description
The implicit type casting when using
max_horizontal
is inconsistent:(1 - 0.5 * pl.col("x")).alias("y")
on thedf
has type f64 and correctly calculates e.g.1-0.5*1 = 0.5
in the first row.pl.max_horizontal(0, 1 - 0.5 * pl.col("x")).alias("z")
has type i32 even though the second expression has type f64 (by point one). I think operations involving i32 and f64 should be casted to f64 if there is any implicit casting.pl.max_horizontal(0.0, 1 - 0.5 * pl.col("x")).alias("w")
has type f64, but it looks like the second column was casted to i32 before themax
aggregation, even though it has type f64 (by point one).pl.max_horizontal(0, 1.0 - 0.5 * pl.col("x")).alias("r")
has type f64 and the output is what I would expect.The same problem applies to
mean_horizontal
.Expected behavior
I would expect the columns
"z"
,"w"
,"r"
to be equal in both cases. The column"r"
is correct.Installed versions
The text was updated successfully, but these errors were encountered: