-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow converting NumPy datetimes to int #8024
Conversation
Thanks for the patch @apmasell, I think that converting |
In [3]: td = np.timedelta64(1, 'Y')
In [4]: td
Out[4]: numpy.timedelta64(1,'Y')
In [5]: int(td)
Out[5]: 1 We'll need to check what numpy is doing to be sure. |
numba/tests/test_npdatetime.py
Outdated
with self.assertRaises((TypeError, TypingError)): | ||
f(DT('2014')) |
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.
Can you add a test when TypingError
is raised that the expected message is shown?
Add support for `int(numpy.datetime64)` and `int(numpy.timedelta64)`.
As titled. Co-authored-by: Siu Kwan Lam <1929845+sklam@users.noreply.github.com>
Ensure the type conversion errors includes the desired message
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.
Sorry for the delay in review. Patch looks good.
Add support for
int(numpy.datetime64)
andint(numpy.timedelta64)
.