-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
API: fix corner case of lib.infer_dtype #23422
Changes from all 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 |
---|---|---|
|
@@ -57,7 +57,7 @@ from tslibs.conversion cimport convert_to_tsobject | |
from tslibs.timedeltas cimport convert_to_timedelta64 | ||
from tslibs.timezones cimport get_timezone, tz_compare | ||
|
||
from missing cimport (checknull, | ||
from missing cimport (checknull, isnaobj, | ||
is_null_datetime64, is_null_timedelta64, is_null_period) | ||
|
||
|
||
|
@@ -1181,6 +1181,9 @@ def infer_dtype(value: object, skipna: bool=False) -> str: | |
values = construct_1d_object_array_from_listlike(value) | ||
|
||
values = getattr(values, 'values', values) | ||
if skipna: | ||
values = values[~isnaobj(values)] | ||
|
||
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 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
cimport
isnaobj, 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
isnaobj
tomissing.pxd
and make it acpdef
. then you can cimport it. (and you need to type return value)