-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix to_datetime(errors='coerce') not swallowing all parser exceptions... #28367
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 2 commits
031fbc7
5226457
26dd0b6
87bedf4
50b072f
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 |
---|---|---|
|
@@ -610,16 +610,17 @@ cpdef array_to_datetime(ndarray[object] values, str errors='raise', | |
py_dt = parse_datetime_string(val, | ||
dayfirst=dayfirst, | ||
yearfirst=yearfirst) | ||
# If the dateutil parser returned tzinfo, capture it | ||
# to check if all arguments have the same tzinfo | ||
tz = py_dt.utcoffset() | ||
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. can the utcoffset() call raise? if not, why move this up? 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. @jbrockmendel this is an issue with the datetutil parser, see #28299 (comment) the issue itself: |
||
|
||
except Exception: | ||
if is_coerce: | ||
iresult[i] = NPY_NAT | ||
continue | ||
raise TypeError("invalid string coercion to " | ||
"datetime") | ||
|
||
# If the dateutil parser returned tzinfo, capture it | ||
# to check if all arguments have the same tzinfo | ||
tz = py_dt.utcoffset() | ||
if tz is not None: | ||
seen_datetime_offset = 1 | ||
# dateutil timezone objects cannot be hashed, so | ||
|
Uh oh!
There was an error while loading. Please reload this page.