Skip to content

BUG: Fix bound checking for Timestamp() with dt64 #4065 #4926

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
Oct 7, 2013

Conversation

danbirken
Copy link
Contributor

closes #4065

To fix the bug, this change adds bounds checking to
_get_datetime64_nanos() for numpy datetimes that aren't already in [ns]
units.

Additionally, it updates _check_dts_bounds() to do the bound check just
based off the pandas_datetimestruct, by comparing to the minimum and
maximum valid pandas_datetimestructs for datetime64[ns]. It is simpler
and more accurate than the previous system.

@jreback
Copy link
Contributor

jreback commented Sep 21, 2013

can u test this in windows? should work but c code changes can sometimes do weird things

@danbirken
Copy link
Contributor Author

Is there any easy way to do that online or do I need to dust off a windows VM?

@jreback
Copy link
Contributor

jreback commented Sep 21, 2013

http://pandas.pydata.org/pandas-docs/dev/install.html for 32-bit

64-bit a little bit non-trivial; there are some online guides

To fix the bug, this change adds bounds checking to
_get_datetime64_nanos() for numpy datetimes that aren't already in [ns]
units.

Additionally, it updates _check_dts_bounds() to do the bound check just
based off the pandas_datetimestruct, by comparing to the minimum and
maximum valid pandas_datetimestructs for datetime64[ns].  It is simpler
and more accurate than the previous system.

Also includes a number of small refactors/fixes to deal with new error
cases that didn't exist when invalid datetime64s were just silently
coerced into the valid datetime64[ns] range.
@jreback jreback merged commit 6d6f392 into pandas-dev:master Oct 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timestamp() is wrong if np.datetime64 < 1678-01-01
2 participants