@@ -509,6 +509,8 @@ def from_breaks(
509
509
"name" : "" ,
510
510
"examples" : textwrap .dedent (
511
511
"""\
512
+ Examples
513
+ --------
512
514
>>> pd.arrays.IntervalArray.from_arrays([0, 1, 2], [1, 2, 3])
513
515
<IntervalArray>
514
516
[(0, 1], (1, 2], (2, 3]]
@@ -1635,9 +1637,8 @@ def __arrow_array__(self, type=None):
1635
1637
1636
1638
return pyarrow .ExtensionArray .from_storage (interval_type , storage_array )
1637
1639
1638
- _interval_shared_docs [
1639
- "to_tuples"
1640
- ] = """
1640
+ _interval_shared_docs ["to_tuples" ] = textwrap .dedent (
1641
+ """
1641
1642
Return an %(return_type)s of tuples of the form (left, right).
1642
1643
1643
1644
Parameters
@@ -1651,9 +1652,27 @@ def __arrow_array__(self, type=None):
1651
1652
tuples: %(return_type)s
1652
1653
%(examples)s\
1653
1654
"""
1655
+ )
1654
1656
1655
1657
@Appender (
1656
- _interval_shared_docs ["to_tuples" ] % {"return_type" : "ndarray" , "examples" : "" }
1658
+ _interval_shared_docs ["to_tuples" ]
1659
+ % {
1660
+ "return_type" : "ndarray" ,
1661
+ "examples" : textwrap .dedent (
1662
+ """\
1663
+
1664
+ Examples
1665
+ --------
1666
+ >>> idx = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 2)])
1667
+ >>> idx
1668
+ <IntervalArray>
1669
+ [(0, 1], (1, 2]]
1670
+ Length: 2, dtype: interval[int64, right]
1671
+ >>> idx.to_tuples()
1672
+ array([(0, 1), (1, 2)], dtype=object)
1673
+ """
1674
+ ),
1675
+ }
1657
1676
)
1658
1677
def to_tuples (self , na_tuple : bool = True ) -> np .ndarray :
1659
1678
tuples = com .asarray_tuplesafe (zip (self ._left , self ._right ))
0 commit comments