Skip to content

Commit d4062f8

Browse files
Backport PR #49386 on branch 1.5.x (DOC: add name parameter to the IntervalIndex for #48911) (#50700)
Backport PR #49386: DOC: add name parameter to the IntervalIndex for #48911 Co-authored-by: silviaovo <[email protected]>
1 parent 0cc9eca commit d4062f8

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

pandas/core/arrays/interval.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ def _from_factorized(
383383
Left and right bounds for each interval.
384384
closed : {'left', 'right', 'both', 'neither'}, default 'right'
385385
Whether the intervals are closed on the left-side, right-side, both
386-
or neither.
386+
or neither.\
387+
%(name)s
387388
copy : bool, default False
388389
Copy the data.
389390
dtype : dtype or None, default None
@@ -408,6 +409,7 @@ def _from_factorized(
408409
_interval_shared_docs["from_breaks"]
409410
% {
410411
"klass": "IntervalArray",
412+
"name": "",
411413
"examples": textwrap.dedent(
412414
"""\
413415
Examples
@@ -443,7 +445,8 @@ def from_breaks(
443445
Right bounds for each interval.
444446
closed : {'left', 'right', 'both', 'neither'}, default 'right'
445447
Whether the intervals are closed on the left-side, right-side, both
446-
or neither.
448+
or neither.\
449+
%(name)s
447450
copy : bool, default False
448451
Copy the data.
449452
dtype : dtype, optional
@@ -485,6 +488,7 @@ def from_breaks(
485488
_interval_shared_docs["from_arrays"]
486489
% {
487490
"klass": "IntervalArray",
491+
"name": "",
488492
"examples": textwrap.dedent(
489493
"""\
490494
>>> pd.arrays.IntervalArray.from_arrays([0, 1, 2], [1, 2, 3])
@@ -520,7 +524,8 @@ def from_arrays(
520524
Array of tuples.
521525
closed : {'left', 'right', 'both', 'neither'}, default 'right'
522526
Whether the intervals are closed on the left-side, right-side, both
523-
or neither.
527+
or neither.\
528+
%(name)s
524529
copy : bool, default False
525530
By-default copy the data, this is compat only and ignored.
526531
dtype : dtype or None, default None
@@ -547,6 +552,7 @@ def from_arrays(
547552
_interval_shared_docs["from_tuples"]
548553
% {
549554
"klass": "IntervalArray",
555+
"name": "",
550556
"examples": textwrap.dedent(
551557
"""\
552558
Examples

pandas/core/indexes/interval.py

+15
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ def __new__(
236236
_interval_shared_docs["from_breaks"]
237237
% {
238238
"klass": "IntervalIndex",
239+
"name": textwrap.dedent(
240+
"""
241+
name : str, optional
242+
Name of the resulting IntervalIndex."""
243+
),
239244
"examples": textwrap.dedent(
240245
"""\
241246
Examples
@@ -266,6 +271,11 @@ def from_breaks(
266271
_interval_shared_docs["from_arrays"]
267272
% {
268273
"klass": "IntervalIndex",
274+
"name": textwrap.dedent(
275+
"""
276+
name : str, optional
277+
Name of the resulting IntervalIndex."""
278+
),
269279
"examples": textwrap.dedent(
270280
"""\
271281
Examples
@@ -297,6 +307,11 @@ def from_arrays(
297307
_interval_shared_docs["from_tuples"]
298308
% {
299309
"klass": "IntervalIndex",
310+
"name": textwrap.dedent(
311+
"""
312+
name : str, optional
313+
Name of the resulting IntervalIndex."""
314+
),
300315
"examples": textwrap.dedent(
301316
"""\
302317
Examples

0 commit comments

Comments
 (0)