Skip to content

Commit 5e57734

Browse files
authored
BUG: inaccurate Index._can_hold_na (#54690)
1 parent b4b96fb commit 5e57734

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

pandas/core/arrays/interval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ def _cmp_method(self, other, op):
764764
if self.closed != other.categories.closed:
765765
return invalid_comparison(self, other, op)
766766

767-
other = other.categories.take(
767+
other = other.categories._values.take(
768768
other.codes, allow_fill=True, fill_value=other.categories._na_value
769769
)
770770

pandas/core/indexes/base.py

-5
Original file line numberDiff line numberDiff line change
@@ -2172,11 +2172,6 @@ def _drop_level_numbers(self, levnums: list[int]):
21722172
@final
21732173
def _can_hold_na(self) -> bool:
21742174
if isinstance(self.dtype, ExtensionDtype):
2175-
if isinstance(self.dtype, IntervalDtype):
2176-
# FIXME(GH#45720): this is inaccurate for integer-backed
2177-
# IntervalArray, but without it other.categories.take raises
2178-
# in IntervalArray._cmp_method
2179-
return True
21802175
return self.dtype._can_hold_na
21812176
if self.dtype.kind in "iub":
21822177
return False

0 commit comments

Comments
 (0)