-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Remove some dead code in core/arrays/interval.py #46128
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9e57d6d
fix column_arrays for array manager
Dr-Irv 2abbc57
merge with upstream/main
Dr-Irv 99158b1
Merge remote-tracking branch 'upstream/main'
Dr-Irv 0f4130d
Merge remote-tracking branch 'upstream/main'
Dr-Irv 24ecfe2
Merge remote-tracking branch 'upstream/main'
Dr-Irv 64f00d5
Merge remote-tracking branch 'upstream/main'
Dr-Irv 1ee6e00
Merge remote-tracking branch 'upstream/main'
Dr-Irv 5761bf2
Merge remote-tracking branch 'upstream/main'
Dr-Irv 84b119f
remove dead code in arrays/interval.py
Dr-Irv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
i think this will break if
self._left
is a DTA/TDA?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.
I'm honestly not sure what type
_left
and_right
has (in #44922 I assumednp.ndarray
but added a note that this is probably not correct - needs some mypy ignore comments). In your attempt at interval.pyi, you marked it as on ofnp.ndarray, "DatetimeArray", "TimedeltaArray"
.https://github.com/pandas-dev/pandas/pull/41059/files#diff-fb052ef16d456d32858ec68d7e9449d4749166ea97c9a79b22d0ccf233dbb3a4R205
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.
Well, that's why I did the test. I don't think that
self._left
can be a DTA or TDA. I guess there is other logic that causes that never to be the case, and the tests seem to confirm that.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.
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.
Yes, but the dead code doesn't go there. The old code is:
The new code is just:
In your example, the test
needs_i8_conversion(dtype)
isFalse
Here is what happens with 1.4.0 and this PR:
With the PR:
That's why we can remove the
if
test.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.
This doesn't make sense to me. dtype should be
np.dtype("M8[ns]")
, for whichneeds_i8_conversion(dtype)
is True.For a starker example, if you pass a tz to the
date_range
, the ser.unique raises in this 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.
OK, the
tz
example shows that what I thought was dead code can't be removed. Will close this PR then.