@@ -120,9 +120,42 @@ class IntervalIndex(IntervalMixin, Index):
120
120
copy : boolean, default False
121
121
Copy the meta-data
122
122
123
+ Examples
124
+ ---------
125
+ A new ``IntervalIndex`` is typically constructed using
126
+ :func:`interval_range`:
127
+
128
+ >>> pd.interval_range(start=0, end=5)
129
+ IntervalIndex([(0, 1], (1, 2], (2, 3], (3, 4], (4, 5]]
130
+ closed='right', dtype='interval[int64]')
131
+
132
+ It may also be constructed using one of the constructor
133
+ methods :meth:`IntervalIndex.from_arrays``,
134
+ :meth:`IntervalIndex.from_breaks``, :meth:`IntervalIndex.from_intervals`
135
+ and :meth:`IntervalIndex.from_tuples``.
136
+
137
+ See further examples in the doc strings of ``interval_range`` and the
138
+ mentioned constructor methods.
139
+
140
+ Notes
141
+ ------
142
+ See the `user guide
143
+ <http://pandas.pydata.org/pandas-docs/stable/advanced.html#intervalindex>`_
144
+ for more.
145
+
123
146
See Also
124
147
--------
125
148
Index
149
+ Interval : A bounded slice-like interval
150
+ interval_range : Function to create a fixed frequency IntervalIndex
151
+ IntervalIndex.from_arrays : Construct an IntervalIndex from a a left and
152
+ right array
153
+ IntervalIndex.from_breaks : Construct an IntervalIndex from an array of
154
+ splits
155
+ IntervalIndex.from_intervals : Construct an IntervalIndex from a array of
156
+ Interval objects
157
+ IntervalIndex.from_tuples : Construct an IntervalIndex from a list/array of
158
+ tuples
126
159
"""
127
160
_typ = 'intervalindex'
128
161
_comparables = ['name' ]
@@ -415,7 +448,9 @@ def from_tuples(cls, data, closed='right', name=None, copy=False):
415
448
416
449
Examples
417
450
--------
418
-
451
+ >>> pd.IntervalIndex.from_tuples([(0, 1), (1,2)])
452
+ IntervalIndex([(0, 1], (1, 2]],
453
+ closed='right', dtype='interval[int64]')
419
454
"""
420
455
left = []
421
456
right = []
@@ -1159,6 +1194,10 @@ def interval_range(start=None, end=None, periods=None, freq=None,
1159
1194
>>> pd.interval_range(end=5, periods=4, closed='both')
1160
1195
IntervalIndex([[1, 2], [2, 3], [3, 4], [4, 5]]
1161
1196
closed='both', dtype='interval[int64]')
1197
+
1198
+ See Also
1199
+ --------
1200
+ IntervalIndex : an Index of intervals that are all closed on the same side.
1162
1201
"""
1163
1202
if com ._count_not_none (start , end , periods ) != 2 :
1164
1203
raise ValueError ('Of the three parameters: start, end, and periods, '
0 commit comments