Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix DataFrame.min/max for decimals #14890

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/polars-core/src/datatypes/dtype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ impl DataType {

let phys = self.to_physical();
(phys.is_numeric()
|| self.is_decimal()
|| matches!(
phys,
DataType::Binary | DataType::String | DataType::Boolean
Expand Down
8 changes: 8 additions & 0 deletions py-polars/tests/unit/datatypes/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ def test_decimal_df_vertical_sum() -> None:
assert_frame_equal(df.sum(), expected)


def test_decimal_df_vertical_agg() -> None:
df = pl.DataFrame({"a": [D("1.0"), D("2.0"), D("3.0")]})
expected_min = pl.DataFrame({"a": [D("1.0")]})
expected_max = pl.DataFrame({"a": [D("3.0")]})
assert_frame_equal(df.min(), expected_min)
assert_frame_equal(df.max(), expected_max)


def test_decimal_in_filter() -> None:
df = pl.DataFrame(
{
Expand Down
Loading