Skip to content

Commit f08437e

Browse files
jschendeljreback
authored andcommitted
CLN: Remove dead IntervalIndex code (#30545)
1 parent af84f45 commit f08437e

File tree

1 file changed

+0
-61
lines changed

1 file changed

+0
-61
lines changed

pandas/core/indexes/interval.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,6 @@ def _get_prev_label(label):
103103
raise TypeError(f"cannot determine next label for type {repr(type(label))}")
104104

105105

106-
def _get_interval_closed_bounds(interval):
107-
"""
108-
Given an Interval or IntervalIndex, return the corresponding interval with
109-
closed bounds.
110-
"""
111-
left, right = interval.left, interval.right
112-
if interval.open_left:
113-
left = _get_next_label(left)
114-
if interval.open_right:
115-
right = _get_prev_label(right)
116-
return left, right
117-
118-
119106
def _new_IntervalIndex(cls, d):
120107
"""
121108
This is called upon unpickling, rather than the default which doesn't have
@@ -675,26 +662,6 @@ def _convert_list_indexer(self, keyarr, kind=None):
675662

676663
return locs
677664

678-
def _maybe_cast_indexed(self, key):
679-
"""
680-
we need to cast the key, which could be a scalar
681-
or an array-like to the type of our subtype
682-
"""
683-
if isinstance(key, IntervalIndex):
684-
return key
685-
686-
subtype = self.dtype.subtype
687-
if is_float_dtype(subtype):
688-
if is_integer(key):
689-
key = float(key)
690-
elif isinstance(key, (np.ndarray, Index)):
691-
key = key.astype("float64")
692-
elif is_integer_dtype(subtype):
693-
if is_integer(key):
694-
key = int(key)
695-
696-
return key
697-
698665
def _can_reindex(self, indexer: np.ndarray) -> None:
699666
"""
700667
Check if we are allowing reindexing with this particular indexer.
@@ -827,34 +794,6 @@ def _searchsorted_monotonic(self, label, side, exclude_label=False):
827794

828795
return sub_idx._searchsorted_monotonic(label, side)
829796

830-
def _find_non_overlapping_monotonic_bounds(self, key):
831-
if isinstance(key, IntervalMixin):
832-
start = self._searchsorted_monotonic(
833-
key.left, "left", exclude_label=key.open_left
834-
)
835-
stop = self._searchsorted_monotonic(
836-
key.right, "right", exclude_label=key.open_right
837-
)
838-
elif isinstance(key, slice):
839-
# slice
840-
start, stop = key.start, key.stop
841-
if (key.step or 1) != 1:
842-
raise NotImplementedError("cannot slice with a slice step")
843-
if start is None:
844-
start = 0
845-
else:
846-
start = self._searchsorted_monotonic(start, "left")
847-
if stop is None:
848-
stop = len(self)
849-
else:
850-
stop = self._searchsorted_monotonic(stop, "right")
851-
else:
852-
# scalar or index-like
853-
854-
start = self._searchsorted_monotonic(key, "left")
855-
stop = self._searchsorted_monotonic(key, "right")
856-
return start, stop
857-
858797
def get_loc(
859798
self, key: Any, method: Optional[str] = None, tolerance=None
860799
) -> Union[int, slice, np.ndarray]:

0 commit comments

Comments
 (0)