-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: IntervalIndex.unique() only contains the first interval if all interval borders are negative #61920
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
base: main
Are you sure you want to change the base?
BUG: IntervalIndex.unique() only contains the first interval if all interval borders are negative #61920
Changes from 6 commits
deea1a0
8f05f9f
606d1c5
e8a7607
843539c
eae020c
3547d84
9be72c7
fce684f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1992,9 +1992,17 @@ def _from_combined(self, combined: np.ndarray) -> IntervalArray: | |
def unique(self) -> IntervalArray: | ||
# No overload variant of "__getitem__" of "ExtensionArray" matches argument | ||
# type "Tuple[slice, int]" | ||
nc = unique( | ||
self._combined.view("complex128")[:, 0] # type: ignore[call-overload] | ||
) | ||
if needs_i8_conversion(self._left.dtype): | ||
nc = unique( | ||
self._combined.view("complex128")[:, 0] # type: ignore[call-overload] | ||
) | ||
else: | ||
nc = unique( | ||
# Using .view("complex128") with negatives causes issues. | ||
# GH#61917 | ||
(np.array(self._combined[:, 0], dtype=complex)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is More Correct, should we just patch inside _combined directly? The only other place it is used is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, agree we can add this logic directly in _combined. |
||
+ (1j * np.array(self._combined[:, 1], dtype=complex)) | ||
) | ||
nc = nc[:, None] | ||
return self._from_combined(nc) | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.