-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REGR: to_datetime, unique with OOB values #31520
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
Conversation
- | ||
- | ||
- Fixed regression in :meth:`to_datetime` when parsing non-nanosecond resolution datetimes (:issue:`31491`) | ||
- Fixed bug in :meth:`to_datetime` raising when ``cache=True`` and out-of-bound values are present (:issue:`31491`) |
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 was present in 0.25.3, so technically not a regression.
Do we want to collect fixed regression in a dedicated section? I think we've done that in the past.
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.
sure would be a-ok
cache_array = _maybe_cache(arg, format, cache, convert_listlike) | ||
try: | ||
cache_array = _maybe_cache(arg, format, cache, convert_listlike) | ||
except tslibs.OutOfBoundsDatetime: |
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.
I think this is the best we can do here, at least without major surgery. It'll involve double-parsing the input for large arrays with errors='coerce'
.
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.
ok, pls create an issue as this should be handled directly in _maybe_cache itself
@@ -191,6 +192,11 @@ def _reconstruct_data(values, dtype, original): | |||
if isinstance(original, ABCIndexClass): | |||
values = values.astype(object, copy=False) | |||
elif dtype is not None: |
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.
is period an issue here? (just comments, can target master)
cache_array = _maybe_cache(arg, format, cache, convert_listlike) | ||
try: | ||
cache_array = _maybe_cache(arg, format, cache, convert_listlike) | ||
except tslibs.OutOfBoundsDatetime: |
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.
ok, pls create an issue as this should be handled directly in _maybe_cache itself
Co-authored-by: Tom Augspurger <[email protected]>
Closes #31491
This turned up two bugs:
to_datetime(oob_values, cache=True, errors='coerce')
would raise. We had tests intended to catch this, but we didn't actually hit it because caching is disabled for inputs less than length 50. We only tested with length 3. I've updated the test to pass that thresholdto_datetime
was raising for non-ns resolution values that aren't OOB for ns resolution. This was a bug inunique
.