Skip to content

Commit 3de26e0

Browse files
DOC: add RT03,SA01 for pandas.IntervalIndex.set_closed and pandas.arrays.IntervalArray.set_closed (#58683)
* DOC: add RT03,SA01 for pandas.IntervalIndex.set_closed and pandas.arrays.IntervalArray.set_closed * DOC: remove RT03,SA01 for pandas.IntervalIndex.set_closed and pandas.arrays.IntervalArray.set_closed
1 parent de9ec9f commit 3de26e0

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

ci/code_checks.sh

-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7777
-i "pandas.DataFrame.plot PR02,SA01" \
7878
-i "pandas.Grouper PR02" \
7979
-i "pandas.IntervalIndex.left GL08" \
80-
-i "pandas.IntervalIndex.set_closed RT03,SA01" \
8180
-i "pandas.MultiIndex PR01" \
8281
-i "pandas.MultiIndex.append PR07,SA01" \
8382
-i "pandas.MultiIndex.copy PR07,RT03,SA01" \
@@ -395,7 +394,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
395394
-i "pandas.arrays.IntervalArray.length SA01" \
396395
-i "pandas.arrays.IntervalArray.mid SA01" \
397396
-i "pandas.arrays.IntervalArray.right SA01" \
398-
-i "pandas.arrays.IntervalArray.set_closed RT03,SA01" \
399397
-i "pandas.arrays.NumpyExtensionArray SA01" \
400398
-i "pandas.arrays.SparseArray PR07,SA01" \
401399
-i "pandas.arrays.TimedeltaArray PR07,SA01" \

pandas/core/arrays/interval.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -1436,28 +1436,38 @@ def closed(self) -> IntervalClosedType:
14361436
"""
14371437
)
14381438

1439-
@Appender(
1440-
_interval_shared_docs["set_closed"]
1441-
% {
1442-
"klass": "IntervalArray",
1443-
"examples": textwrap.dedent(
1444-
"""\
1439+
def set_closed(self, closed: IntervalClosedType) -> Self:
1440+
"""
1441+
Return an identical IntervalArray closed on the specified side.
1442+
1443+
Parameters
1444+
----------
1445+
closed : {'left', 'right', 'both', 'neither'}
1446+
Whether the intervals are closed on the left-side, right-side, both
1447+
or neither.
1448+
1449+
Returns
1450+
-------
1451+
IntervalArray
1452+
A new IntervalArray with the specified side closures.
1453+
1454+
See Also
1455+
--------
1456+
IntervalArray.closed : Returns inclusive side of the Interval.
1457+
arrays.IntervalArray.closed : Returns inclusive side of the IntervalArray.
1458+
14451459
Examples
14461460
--------
14471461
>>> index = pd.arrays.IntervalArray.from_breaks(range(4))
14481462
>>> index
14491463
<IntervalArray>
14501464
[(0, 1], (1, 2], (2, 3]]
14511465
Length: 3, dtype: interval[int64, right]
1452-
>>> index.set_closed('both')
1466+
>>> index.set_closed("both")
14531467
<IntervalArray>
14541468
[[0, 1], [1, 2], [2, 3]]
14551469
Length: 3, dtype: interval[int64, both]
14561470
"""
1457-
),
1458-
}
1459-
)
1460-
def set_closed(self, closed: IntervalClosedType) -> Self:
14611471
if closed not in VALID_CLOSED:
14621472
msg = f"invalid option for 'closed': {closed}"
14631473
raise ValueError(msg)

0 commit comments

Comments
 (0)