From 965cd10e22112cfe4705049e44b732b9bc5d397e Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Sun, 12 May 2024 23:54:47 +0530 Subject: [PATCH 1/3] DOC: add GL08 for pandas.IntervalIndex.left mroeschke --- pandas/core/indexes/interval.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index 4b9d055382c48..dc179099ab93b 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -842,6 +842,39 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool: @cache_readonly def left(self) -> Index: + """ + Return left bounds of the intervals in the IntervalIndex. + + The left bounds of each interval in the IntervalIndex are + returned as an Index. The datatype of the left bounds is the + same as the datatype of the endpoints of the intervals. + + Returns + ------- + Index + An Index containing the left bounds of the intervals. + + See Also + -------- + IntervalIndex.right : Return the right 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 + Index([1, 2, 3], dtype='int64') + + >>> iv_idx = pd.IntervalIndex.from_tuples( + ... [(1, 4), (2, 5), (3, 6)], closed="left" + ... ) + >>> iv_idx.left + Index([1, 2, 3], dtype='int64') + """ return Index(self._data.left, copy=False) @cache_readonly From ae0415e1a622466d617fa3cf6219da255e29f5b7 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Sun, 12 May 2024 23:59:23 +0530 Subject: [PATCH 2/3] DOC: remove GL08 for pandas.IntervalIndex.left Co-authored-by: mroeschke --- ci/code_checks.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 857a2d3216b89..7bca0c977471a 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -76,7 +76,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DataFrame.min RT03" \ -i "pandas.DataFrame.plot PR02,SA01" \ -i "pandas.Grouper PR02" \ - -i "pandas.IntervalIndex.left GL08" \ -i "pandas.MultiIndex PR01" \ -i "pandas.MultiIndex.append PR07,SA01" \ -i "pandas.MultiIndex.copy PR07,RT03,SA01" \ From 3ce6bb2f72cd85e2e52651a797338dbddd34d2a0 Mon Sep 17 00:00:00 2001 From: tuhinsharma121 Date: Mon, 13 May 2024 00:01:25 +0530 Subject: [PATCH 3/3] DOC: fix example for iv_idx.left --- 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 dc179099ab93b..92c399da21ce6 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -866,7 +866,7 @@ def left(self) -> Index: Examples -------- >>> iv_idx = pd.IntervalIndex.from_arrays([1, 2, 3], [4, 5, 6], closed="right") - >>> iv_idx.right + >>> iv_idx.left Index([1, 2, 3], dtype='int64') >>> iv_idx = pd.IntervalIndex.from_tuples(