-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: disallow exotic np.datetime64 unit #61882
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
pandas/_libs/tslibs/conversion.pyx
Outdated
@@ -367,6 +369,13 @@ cdef _TSObject convert_to_tsobject(object ts, tzinfo tz, str unit, | |||
if checknull_with_nat_and_na(ts): | |||
obj.value = NPY_NAT | |||
elif cnp.is_datetime64_object(ts): | |||
num = (<PyDatetimeScalarObject*>obj).obmeta.num |
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.
num = (<PyDatetimeScalarObject*>obj).obmeta.num | |
num = (<PyDatetimeScalarObject*>ts).obmeta.num |
Took me embarrassingly long to spot :).
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.
You're embarrassed? I'm the one who screwed it up in the first place!
pandas/_libs/tslibs/conversion.pyx
Outdated
raise ValueError( | ||
# GH#25611 | ||
"np.datetime64 objects with units containing a multiplier are " | ||
"not supported", num |
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 the num
at the end here intended?
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.
that was for debugging, will update
Thanks @jbrockmendel |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This doesn't work locally for reasons described here. @seberg says it should work, so let's see if the CI can prove him right.