diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 87a2aac538572..de558171d9dd8 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -77,7 +77,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DataFrame.plot PR02,SA01" \ -i "pandas.Grouper PR02" \ -i "pandas.Index PR07" \ - -i "pandas.IntervalIndex.get_loc PR07,RT03,SA01" \ -i "pandas.IntervalIndex.is_non_overlapping_monotonic SA01" \ -i "pandas.IntervalIndex.left GL08" \ -i "pandas.IntervalIndex.length GL08" \ diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index 058d59f401833..dcc5d3e4c3332 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -621,13 +621,27 @@ def get_loc(self, key) -> int | slice | np.ndarray: """ Get integer location, slice or boolean mask for requested label. + The `get_loc` method is used to retrieve the integer index, a slice for + slicing objects, or a boolean mask indicating the presence of the label + in the `IntervalIndex`. + Parameters ---------- key : label + The value or range to find in the IntervalIndex. Returns ------- int if unique index, slice if monotonic index, else mask + The position or positions found. This could be a single + number, a range, or an array of true/false values + indicating the position(s) of the label. + + See Also + -------- + IntervalIndex.get_indexer_non_unique : Compute indexer and + mask for new index given the current index. + Index.get_loc : Similar method in the base Index class. Examples --------