Repository navigation
fix: support non-float polars columns in is_nan_or_none #297
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,6 +247,10 @@ def is_none(s: Series) -> Series: | |
|
|
||
|
|
||
| def is_nan_or_none(s: Series) -> Series: | ||
| if isinstance(s, pl_Series) and not s.dtype.is_float(): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please move this to the is_nan function. in the polars branch we can check if its float and call is_nan and otherwise return a series filled with false
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in a4c1d45. |
||
| # polars only supports is_nan on numeric columns and only floats | ||
| # can hold NaN, so other columns (e.g. strings) can only have nulls | ||
| return s.is_null() | ||
| return is_nan(s) | is_none(s) | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move these to the is_nan test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved them to
test_is_nanin a4c1d45. They checkis_nanon string, boolean, integer and categorical series, andis_nan_or_noneon the same series.