Skip to content

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

Merged
merged 1 commit into from
Feb 1, 2020

Conversation

TomAugspurger
Copy link
Contributor

Closes #31491

This turned up two bugs:

  1. 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 threshold
  2. The original report, that to_datetime was raising for non-ns resolution values that aren't OOB for ns resolution. This was a bug in unique.

@TomAugspurger TomAugspurger added Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Timedelta Timedelta data type Datetime Datetime data dtype labels Jan 31, 2020
@TomAugspurger TomAugspurger added this to the 1.0.1 milestone Jan 31, 2020
-
-
- 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`)
Copy link
Contributor Author

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.

Copy link
Contributor

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:
Copy link
Contributor Author

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'.

Copy link
Contributor

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:
Copy link
Contributor

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:
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Datetime Datetime data dtype Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in pd.to_datetime, with argument np.datetime64 array of 51 elements
2 participants