Skip to content

Commit

Permalink
DOC: Enforce Numpy Docstring Validation for pandas.IntervalIndex.right (
Browse files Browse the repository at this point in the history
#58650)

* DOC: add GL08 for pandas.IntervalIndex.right

* DOC: remove GL08 for pandas.IntervalIndex.right

* DOC: add GL08 for pandas.IntervalIndex.right

* DOC: add GL08 for pandas.IntervalIndex.right
  • Loading branch information
tuhinsharma121 committed May 9, 2024
1 parent d2a6e42 commit 5786f14
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Expand Up @@ -82,7 +82,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" \
Expand Down
33 changes: 33 additions & 0 deletions pandas/core/indexes/interval.py
Expand Up @@ -832,6 +832,39 @@ def left(self) -> Index:

@cache_readonly
def right(self) -> Index:
"""
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
same as the datatype of the endpoints of the intervals.
Returns
-------
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
Expand Down

0 comments on commit 5786f14

Please sign in to comment.