Skip to content

Commit 965cd10

Browse files
DOC: add GL08 for pandas.IntervalIndex.left
mroeschke
1 parent 3de26e0 commit 965cd10

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

pandas/core/indexes/interval.py

+33
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,39 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool:
842842

843843
@cache_readonly
844844
def left(self) -> Index:
845+
"""
846+
Return left bounds of the intervals in the IntervalIndex.
847+
848+
The left bounds of each interval in the IntervalIndex are
849+
returned as an Index. The datatype of the left bounds is the
850+
same as the datatype of the endpoints of the intervals.
851+
852+
Returns
853+
-------
854+
Index
855+
An Index containing the left bounds of the intervals.
856+
857+
See Also
858+
--------
859+
IntervalIndex.right : Return the right bounds of the intervals
860+
in the IntervalIndex.
861+
IntervalIndex.mid : Return the mid-point of the intervals in
862+
the IntervalIndex.
863+
IntervalIndex.length : Return the length of the intervals in
864+
the IntervalIndex.
865+
866+
Examples
867+
--------
868+
>>> iv_idx = pd.IntervalIndex.from_arrays([1, 2, 3], [4, 5, 6], closed="right")
869+
>>> iv_idx.right
870+
Index([1, 2, 3], dtype='int64')
871+
872+
>>> iv_idx = pd.IntervalIndex.from_tuples(
873+
... [(1, 4), (2, 5), (3, 6)], closed="left"
874+
... )
875+
>>> iv_idx.left
876+
Index([1, 2, 3], dtype='int64')
877+
"""
845878
return Index(self._data.left, copy=False)
846879

847880
@cache_readonly

0 commit comments

Comments
 (0)