From 3c6f4e7ae51ee10ceae5a341455e4048bb464173 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Thu, 9 May 2024 17:36:20 +0530 Subject: [PATCH 1/4] DOC: add GL08 for pandas.IntervalIndex.right --- pandas/core/indexes/interval.py | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index 36f181110eccd..bdb61cd06d24f 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -832,6 +832,40 @@ def left(self) -> Index: @cache_readonly def right(self) -> Index: + """ + Return an Index containing the right bounds of the intervals + in the IntervalIndex. + + The right bounds of each interval in the IntervalIndex are + returned as an Index. The datatype of the right bounds is the + same as the datatype of the endpoints of the intervals. + + Returns + ------- + pandas.Index + An Index containing the right bounds of the intervals. + + See Also + -------- + IntervalIndex.left : Return the left bounds of the intervals + in the IntervalIndex. + IntervalIndex.mid : Return the mid-point of the intervals in + the IntervalIndex. + IntervalIndex.length : Return the length of the intervals in + the IntervalIndex. + + Examples + -------- + >>> iv_idx = pd.IntervalIndex.from_arrays([1, 2, 3], [4, 5, 6], closed="right") + >>> iv_idx.right + Int64Index([4, 5, 6], dtype='int64') + + >>> iv_idx = pd.IntervalIndex.from_tuples( + ... [(1, 4), (2, 5), (3, 6)], closed="left" + ... ) + >>> iv_idx.right + Int64Index([4, 5, 6], dtype='int64') + """ return Index(self._data.right, copy=False) @cache_readonly From 2dd57c16a7899351b9fec4037d612270a644aa18 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Thu, 9 May 2024 17:37:05 +0530 Subject: [PATCH 2/4] DOC: remove GL08 for pandas.IntervalIndex.right --- ci/code_checks.sh | 1 - pandas/core/indexes/interval.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 7994835df6f45..976ae352914ba 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -83,7 +83,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.IntervalIndex.left GL08" \ -i "pandas.IntervalIndex.length GL08" \ -i "pandas.IntervalIndex.mid GL08" \ - -i "pandas.IntervalIndex.right GL08" \ -i "pandas.IntervalIndex.set_closed RT03,SA01" \ -i "pandas.IntervalIndex.to_tuples RT03,SA01" \ -i "pandas.MultiIndex PR01" \ diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index bdb61cd06d24f..eac9f487ef3fd 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -842,7 +842,7 @@ def right(self) -> Index: Returns ------- - pandas.Index + Index An Index containing the right bounds of the intervals. See Also From 5b500c33a34c1d793a2272313bdf3a8b39586472 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Thu, 9 May 2024 17:55:51 +0530 Subject: [PATCH 3/4] DOC: add GL08 for pandas.IntervalIndex.right --- pandas/core/indexes/interval.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index eac9f487ef3fd..629bad7d3b6fc 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -833,8 +833,7 @@ def left(self) -> Index: @cache_readonly def right(self) -> Index: """ - Return an Index containing the right bounds of the intervals - in the IntervalIndex. + Return an Index having the right bounds of the intervals in the IntervalIndex. The right bounds of each interval in the IntervalIndex are returned as an Index. The datatype of the right bounds is the From af8430f2ed90c757b27f79c8f20700e708837aec Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Thu, 9 May 2024 17:56:35 +0530 Subject: [PATCH 4/4] DOC: add GL08 for pandas.IntervalIndex.right --- pandas/core/indexes/interval.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index 629bad7d3b6fc..058d59f401833 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -833,7 +833,7 @@ def left(self) -> Index: @cache_readonly def right(self) -> Index: """ - Return an Index having the right bounds of the intervals in the IntervalIndex. + Return right bounds of the intervals in the IntervalIndex. The right bounds of each interval in the IntervalIndex are returned as an Index. The datatype of the right bounds is the