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(python)!: Support decimals by default when converting from Arrow #15324

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Mar 27, 2024

Closes #15152

Changes

  • Update conversion from Arrow to always convert Decimals into Polars Decimals, rather than cast to Float64.
  • Deprecate Config.activate_decimals

Example

Before

>>> from decimal import Decimal as D
>>> import pyarrow as pa
>>> arr = pa.array([D("1.01"), D("2.25")])
>>> pl.from_arrow(arr)
shape: (2,)
Series: '' [f64]
[
        1.01
        2.25
]

After

>>> pl.from_arrow(arr)
shape: (2,)
Series: '' [decimal[3,2]]
[
        1.01
        2.25
]

@github-actions github-actions bot added breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Mar 27, 2024
@stinodego stinodego added this to the 1.0.0 milestone Mar 27, 2024
@stinodego stinodego added the do not merge This pull requests should not be merged right now label Mar 27, 2024
@stinodego stinodego marked this pull request as ready for review March 27, 2024 11:16
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.35%. Comparing base (2de5764) to head (d39a9a8).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15324      +/-   ##
==========================================
- Coverage   81.36%   81.35%   -0.01%     
==========================================
  Files        1364     1364              
  Lines      176615   176588      -27     
  Branches     2526     2524       -2     
==========================================
- Hits       143696   143668      -28     
- Misses      32435    32437       +2     
+ Partials      484      483       -1     

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

@JulianCologne
Copy link
Contributor

nice! This would also resolve #15152

@stinodego stinodego changed the title feat(python)!: Activate Decimals by default feat(python)!: Support decimals by default when converting from PyArrow Mar 27, 2024
@stinodego stinodego changed the title feat(python)!: Support decimals by default when converting from PyArrow feat(python)!: Support decimals by default when converting from Arrow Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Change that breaks backwards compatibility do not merge This pull requests should not be merged right now enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

activate_decimals Problematic and confusing
2 participants