Skip to content

CLN: Remove dead IntervalIndex code #30545

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

Merged
merged 1 commit into from
Dec 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@ def _get_prev_label(label):
raise TypeError(f"cannot determine next label for type {repr(type(label))}")


def _get_interval_closed_bounds(interval):
"""
Given an Interval or IntervalIndex, return the corresponding interval with
closed bounds.
"""
left, right = interval.left, interval.right
if interval.open_left:
left = _get_next_label(left)
if interval.open_right:
right = _get_prev_label(right)
return left, right


def _new_IntervalIndex(cls, d):
"""
This is called upon unpickling, rather than the default which doesn't have
Expand Down Expand Up @@ -675,26 +662,6 @@ def _convert_list_indexer(self, keyarr, kind=None):

return locs

def _maybe_cast_indexed(self, key):
"""
we need to cast the key, which could be a scalar
or an array-like to the type of our subtype
"""
if isinstance(key, IntervalIndex):
return key

subtype = self.dtype.subtype
if is_float_dtype(subtype):
if is_integer(key):
key = float(key)
elif isinstance(key, (np.ndarray, Index)):
key = key.astype("float64")
elif is_integer_dtype(subtype):
if is_integer(key):
key = int(key)

return key

def _can_reindex(self, indexer: np.ndarray) -> None:
"""
Check if we are allowing reindexing with this particular indexer.
Expand Down Expand Up @@ -827,34 +794,6 @@ def _searchsorted_monotonic(self, label, side, exclude_label=False):

return sub_idx._searchsorted_monotonic(label, side)

def _find_non_overlapping_monotonic_bounds(self, key):
if isinstance(key, IntervalMixin):
start = self._searchsorted_monotonic(
key.left, "left", exclude_label=key.open_left
)
stop = self._searchsorted_monotonic(
key.right, "right", exclude_label=key.open_right
)
elif isinstance(key, slice):
# slice
start, stop = key.start, key.stop
if (key.step or 1) != 1:
raise NotImplementedError("cannot slice with a slice step")
if start is None:
start = 0
else:
start = self._searchsorted_monotonic(start, "left")
if stop is None:
stop = len(self)
else:
stop = self._searchsorted_monotonic(stop, "right")
else:
# scalar or index-like

start = self._searchsorted_monotonic(key, "left")
stop = self._searchsorted_monotonic(key, "right")
return start, stop

def get_loc(
self, key: Any, method: Optional[str] = None, tolerance=None
) -> Union[int, slice, np.ndarray]:
Expand Down