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): Add replace_all expression to complement replace #16557

Merged
merged 3 commits into from
May 30, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented May 29, 2024

Ref #14302

Changes

  • Add replace_all, which is exactly the same as replace was, with the exception that defaults to filling unmatched values with null.
  • Deprecate the default and return_dtype parameters for replace.

This should be followed up with a breaking change that makes sure replace always keeps the original data type, instead of casting to the supertype of the original and the new values.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels May 29, 2024
@stinodego stinodego marked this pull request as ready for review May 29, 2024 00:32
@stinodego stinodego added the deprecation Add a deprecation warning to outdated functionality label May 29, 2024
Copy link

codecov bot commented May 29, 2024

Codecov Report

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

Project coverage is 81.48%. Comparing base (cb40bbd) to head (c6382fd).
Report is 11 commits behind head on main.

Files Patch % Lines
py-polars/polars/expr/expr.py 89.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16557      +/-   ##
==========================================
+ Coverage   81.47%   81.48%   +0.01%     
==========================================
  Files        1412     1414       +2     
  Lines      185474   185579     +105     
  Branches     2996     3002       +6     
==========================================
+ Hits       151119   151225     +106     
+ Misses      33839    33837       -2     
- Partials      516      517       +1     

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

@ritchie46
Copy link
Member

This should be added on the rust side as well.

@stinodego
Copy link
Member Author

stinodego commented May 29, 2024

This should be added on the rust side as well.

I'll add that when I'm making the breaking change to casting behavior for 1.0 - it'll be easier then!

EDIT: I think I can do some of the work already, working on it...

EDIT2: Nope, it's a hassle. Let's merge like this and I can do this without jumping through hoops to avoid breaking something.

@stinodego stinodego marked this pull request as draft May 29, 2024 09:44
@stinodego stinodego marked this pull request as ready for review May 29, 2024 09:52
@ritchie46 ritchie46 merged commit 3ac1c40 into main May 30, 2024
14 checks passed
@ritchie46 ritchie46 deleted the depr-replace branch May 30, 2024 06:24
@stinodego stinodego added the skip changelog Do not include in changelog label May 31, 2024
@c-peters c-peters added the accepted Ready for implementation label Jun 3, 2024
@stinodego stinodego restored the depr-replace branch June 7, 2024 07:54
@stinodego stinodego deleted the depr-replace branch June 7, 2024 21:06
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation deprecation Add a deprecation warning to outdated functionality enhancement New feature or an improvement of an existing feature python Related to Python Polars skip changelog Do not include in changelog
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants