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 DataType.is_integer and other dtype groups #12200

Merged
merged 11 commits into from
Nov 14, 2023

Conversation

stinodego
Copy link
Contributor

@stinodego stinodego commented Nov 2, 2023

Partially addresses #12196

This includes the "dtype group" methods on DataType:

  • is_numeric
  • is_integer
  • is_signed_integer
  • is_unsigned_integer
  • is_float
  • is_temporal

(is_nested cannot be added right now - I will add it as a breaking change in the next breaking release)

This PR also deprecates the similar methods on Series. Users should call the Series.dtype and then call the new methods instead.

This illustrates the syntax and implementation. For our internal use, you can see it has the additional benefit of not having to import the dtype groups everywhere.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Nov 2, 2023
@stinodego stinodego marked this pull request as ready for review November 2, 2023 14:34
@stinodego stinodego marked this pull request as draft November 2, 2023 14:40
@stinodego stinodego marked this pull request as ready for review November 2, 2023 14:44
@stinodego stinodego changed the title feat(python): Add DataType.is_integer/float/temporal feat(python): Add DataType.is_integer and other dtype groups Nov 2, 2023
@stinodego stinodego marked this pull request as draft November 2, 2023 23:30
@stinodego stinodego marked this pull request as ready for review November 3, 2023 00:22
@stinodego stinodego added the deprecation Add a deprecation warning to outdated functionality label Nov 3, 2023
@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Nov 4, 2023

Gets my vote (consolidating these methods on dtype is especially nice for consistency and cleaning up Series) ✌️

@stinodego stinodego merged commit 8af2048 into main Nov 14, 2023
12 checks passed
@stinodego stinodego deleted the is-dtype-methods branch November 14, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation Add a deprecation warning to outdated functionality 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.

3 participants