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

feat: Support describe on decimal #15092

Merged
merged 1 commit into from
Jul 11, 2024
Merged

feat: Support describe on decimal #15092

merged 1 commit into from
Jul 11, 2024

Conversation

flisky
Copy link
Contributor

@flisky flisky commented Mar 16, 2024

fix #13732

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Mar 16, 2024
Copy link

codecov bot commented Mar 16, 2024

Codecov Report

Attention: Patch coverage is 98.68421% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 81.22%. Comparing base (5d449cc) to head (0cabf0b).
Report is 20 commits behind head on main.

Files Patch % Lines
...polars-core/src/chunked_array/ops/aggregate/mod.rs 98.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15092      +/-   ##
==========================================
+ Coverage   81.06%   81.22%   +0.15%     
==========================================
  Files        1342     1346       +4     
  Lines      173935   175299    +1364     
  Branches     2459     2506      +47     
==========================================
+ Hits       141000   142386    +1386     
+ Misses      32468    32433      -35     
- Partials      467      480      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Mar 18, 2024

I'll defer to others (@orlp?) but I don't think casting to f64 is a valid approach here 🤔 It's both an expensive conversion and, importantly, loses the point of using Decimal for calculations in the first place (the fixed-precision guarantees).

@orlp
Copy link
Collaborator

orlp commented Mar 18, 2024

@alexander-beedie I think it's fine for describe.

@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Mar 18, 2024

@alexander-beedie I think it's fine for describe.

If it was constrained within the describe method then I'd agree, but the implementation appears to be available everywhere (describe uses select internally), eg:

df.select(
    sum=pl.sum("a"),
    min=pl.min("a"),
    max=pl.max("a"),
    mean=pl.mean("a"),
    median=pl.median("a"),
)

@flisky
Copy link
Contributor Author

flisky commented Mar 19, 2024

It turned out only mean need to be specialized for i128.
Please take a look, thanks!

@stinodego stinodego requested a review from reswqa as a code owner June 28, 2024 17:53
@marcounternaehrer-cf
Copy link

Any chance to get this reviewed? :)

@flisky
Copy link
Contributor Author

flisky commented Jul 10, 2024

Rebased!

@ritchie46
Copy link
Member

Thanks @flisky

@ritchie46 ritchie46 merged commit 7c2598a into pola-rs:main Jul 11, 2024
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
5 participants