-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DataFrame from dict with non-nano Timedelta #48901
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
# resolution. | ||
try: | ||
obj = self._as_reso(<NPY_DATETIMEUNIT>(self._reso + 1)) | ||
except OverflowError: |
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.
Do the unit test hit both the except
and else
branch?
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.
just reach one branch, will add test(s)
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.
Did these get added?
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.
good catch, not yet
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.
updated per request
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Thanks @jbrockmendel |
* BUG: DataFrame from dict with non-nano Timedelta * fix __hash__ * test for both hash cases
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.xref #44504
This is motivated by a branch (upcoming PR) that makes the Timedelta constructor preserve resolution when passed a np.timedelta64 object. Without this change, test_constructor_dict_timedelta64_index fails because of a dict lookup in lib.fast_multiget.
For non-nano Timedeltas this does significantly hurt performance:
I expect there's room for optimization. Something like: