-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
API: fix corner case of lib.infer_dtype #23422
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
Changes from 5 commits
8e1e97e
3f988e8
08d67e8
bcc481b
c0ded96
7e5d453
8ace6c7
3ce5776
a533ed8
19cf2dd
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 |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ from tslibs.timezones cimport get_timezone, tz_compare | |
|
|
||
| from missing cimport (checknull, | ||
| is_null_datetime64, is_null_timedelta64, is_null_period) | ||
| from missing import isnaobj | ||
|
|
||
|
|
||
| # constants that will be compared to potentially arbitrarily large | ||
|
|
@@ -1171,6 +1172,9 @@ def infer_dtype(object value, bint skipna=False): | |
| values = construct_1d_object_array_from_listlike(value) | ||
|
|
||
| values = getattr(values, 'values', values) | ||
| if skipna: | ||
| values = values[~isnaobj(values)] | ||
|
|
||
|
Member
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. I wonder if we can incorporate this
Contributor
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. Unfortunately, that's not directly possible (nor performant), because the line directly below (with |
||
| val = _try_infer_map(values) | ||
| if val is not None: | ||
| return val | ||
|
|
||
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.
this is a python and not a cimport, why are you not using checknull?
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.
checknull only returns a single bint, and not an array. I would have liked to
cimportisnaobj, but that didn't work.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.
so this isn array, ok, then add
isnaobjtomissing.pxdand make it acpdef. then you can cimport it. (and you need to type return value)