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 Series/Expr.has_nulls and deprecate Series.has_validity #16488

Merged
merged 5 commits into from
May 26, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented May 25, 2024

The presence of a validity buffer is internals information that should not be part of the public API.

This PR adds a has_nulls method that can be used to check for null values. For now it's only available on the Python side, and the implementation is naive. We can optimize this later.

The has_nulls method should be added to the Rust side as well.

@orlp FYI - I'll leave the Rust side to you :)

@github-actions github-actions bot added deprecation Add a deprecation warning to outdated functionality python Related to Python Polars labels May 25, 2024
@ritchie46
Copy link
Member

Yes, I see merit in a has_nulls which we can later optimize. We don't have to trigger a full null count to answer that question.

Copy link

codecov bot commented May 25, 2024

Codecov Report

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

Project coverage is 81.48%. Comparing base (d68d499) to head (d19d650).
Report is 2 commits behind head on main.

Files Patch % Lines
py-polars/polars/series/series.py 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16488      +/-   ##
==========================================
+ Coverage   81.42%   81.48%   +0.05%     
==========================================
  Files        1409     1409              
  Lines      184924   184942      +18     
  Branches     2978     2981       +3     
==========================================
+ Hits       150577   150692     +115     
+ Misses      33826    33730      -96     
+ Partials      521      520       -1     

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

@stinodego
Copy link
Member Author

Yes, I see merit in a has_nulls which we can later optimize. We don't have to trigger a full null count to answer that question.

Shall I add a (naive) Series.has_nulls as part of this PR then, and deprecate in favor of that?

Other names I've considered are has_null, contains_nulls, or contains_null. Ultimately I think has_nulls is the best out of those 4.

@ritchie46
Copy link
Member

Shall I add a (naive) Series.has_nulls as part of this PR then, and deprecate in favor of that?

Yes, let's do that. 👍

@stinodego stinodego changed the title depr(python): Deprecate Series.has_validity feat(python): Add Series/Expr.has_nulls and deprecate Series.has_validity May 25, 2024
@github-actions github-actions bot added the enhancement New feature or an improvement of an existing feature label May 25, 2024
@ritchie46 ritchie46 merged commit 9eedeb9 into main May 26, 2024
14 checks passed
@ritchie46 ritchie46 deleted the depr-has-validity branch May 26, 2024 06:23
@c-peters c-peters added the accepted Ready for implementation label May 27, 2024
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
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants