Skip to content

Commit

Permalink
fix(rust): make 100 * pl.col(pl.Boolean).mean() work (#13725)
Browse files Browse the repository at this point in the history
Co-authored-by: Wainberg <m.wainberg@utoronto.ca>
  • Loading branch information
Wainberg and Wainberg committed Jan 23, 2024
1 parent f4d46ac commit 88475d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/polars-plan/src/logical_plan/aexpr/schema.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use super::*;

fn float_type(field: &mut Field) {
if field.dtype.is_numeric() && !matches!(&field.dtype, DataType::Float32) {
if (field.dtype.is_numeric() || field.dtype == DataType::Boolean)
&& field.dtype != DataType::Float32
{
field.coerce(DataType::Float64)
}
}
Expand Down
2 changes: 1 addition & 1 deletion py-polars/tests/unit/streaming/test_streaming_group_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_streaming_group_by_types() -> None:
"str_sum": pl.String,
"bool_first": pl.Boolean,
"bool_last": pl.Boolean,
"bool_mean": pl.Boolean,
"bool_mean": pl.Float64,
"bool_sum": pl.UInt32,
"date_sum": pl.Date,
"date_mean": pl.Date,
Expand Down

0 comments on commit 88475d2

Please sign in to comment.