Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BUG: appending a Timedelta to Series incorrectly casts to integer #27303
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
BUG: appending a Timedelta to Series incorrectly casts to integer #27303
Changes from 2 commits
864c32b
82cfca4
e4e6629
2c6d922
d1b06fc
9feab49
4731aaf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Was this hitting the except clause before? Not super familiar with this code but seems like some duplication we could ideally clean up / refactor
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.
It was not raising in the relevant case, and the np.concatenate would cast the timedelta64 to int64.
Yes, this method in particular is in dire need of a refactor. ATM I'm focused on
Block._try_coerce_arg
andBlock._can_hold_element
(see other open PRs) and I think/hope once some inconsistencies in those are ironed out, some of the special-casing here may be unnecessary.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.
should really put this in a test_timedelta.py (and take the existing tests out of test_indexing).
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.
after the current batch of PRs I'm planning on doing a review of the indexing tests. There are multiple dimensions along which we can sort/parametrize, any of which would be reasonable, but my guess is we are not being consistent about it.
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.
new test pls & parameterize over timedelta & np.timedelta64 as wel
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.
Lost previous comment but can you use
tm.assert_series_equal
here? Also move to a separate test (test_timedelta_assignment_to_object
?)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.
will do
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 compare vs the expected series instead