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 clip for Decimal returning wrong values #20814

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

lukemanley
Copy link
Contributor

import polars as pl
from decimal import Decimal as D

df = pl.Series("a", ["1.1", "2.2", "3.3"], pl.Decimal(21, 1)).to_frame()

df.select(
    pl.col("a").clip(lower_bound=D("1.5"), upper_bound=D("2.5"))
)

BEFORE:

shape: (3, 1)
┌───────────────┐
│ a             │
│ ---           │
│ decimal[21,1] │
╞═══════════════╡
│ 15.0          │
│ 22.0          │
│ 25.0          │
└───────────────┘

AFTER:

shape: (3, 1)
┌───────────────┐
│ a             │
│ ---           │
│ decimal[21,1] │
╞═══════════════╡
│ 1.5           │
│ 2.2           │
│ 2.5           │
└───────────────┘

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Jan 21, 2025
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.63%. Comparing base (099ee3c) to head (5453119).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #20814   +/-   ##
=======================================
  Coverage   79.63%   79.63%           
=======================================
  Files        1568     1568           
  Lines      222970   222958   -12     
  Branches     2544     2544           
=======================================
- Hits       177555   177551    -4     
+ Misses      44831    44823    -8     
  Partials      584      584           

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

@ritchie46
Copy link
Member

Thanks a lot @lukemanley 🙌

@ritchie46 ritchie46 merged commit 91f1551 into pola-rs:main Jan 21, 2025
28 checks passed
@lukemanley lukemanley deleted the clip-decimal branch January 23, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants