Skip to content

Commit 4f9318d

Browse files
Merge branch 'main' into enh-latex-centering
2 parents 98c9164 + f2eb667 commit 4f9318d

File tree

4 files changed

+314
-63
lines changed

4 files changed

+314
-63
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ Interval
10441044
- :meth:`Index.is_monotonic_decreasing`, :meth:`Index.is_monotonic_increasing`, and :meth:`Index.is_unique` could incorrectly be ``False`` for an ``Index`` created from a slice of another ``Index``. (:issue:`57911`)
10451045
- Bug in :class:`Index`, :class:`Series`, :class:`DataFrame` constructors when given a sequence of :class:`Interval` subclass objects casting them to :class:`Interval` (:issue:`46945`)
10461046
- Bug in :func:`interval_range` where start and end numeric types were always cast to 64 bit (:issue:`57268`)
1047+
- Bug in :meth:`IntervalIndex.get_indexer` and :meth:`IntervalIndex.drop` when one of the sides of the index is non-unique (:issue:`52245`)
10471048

10481049
Indexing
10491050
^^^^^^^^

pandas/core/indexes/interval.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,10 @@ def _get_indexer(
712712
# -> at most one match per interval in target
713713
# want exact matches -> need both left/right to match, so defer to
714714
# left/right get_indexer, compare elementwise, equality -> match
715-
indexer = self._get_indexer_unique_sides(target)
715+
if self.left.is_unique and self.right.is_unique:
716+
indexer = self._get_indexer_unique_sides(target)
717+
else:
718+
indexer = self._get_indexer_pointwise(target)[0]
716719

717720
elif not (is_object_dtype(target.dtype) or is_string_dtype(target.dtype)):
718721
# homogeneous scalar index: use IntervalTree

0 commit comments

Comments
 (0)