|
38 | 38 |
|
39 | 39 | _index_doc_kwargs.update(
|
40 | 40 | dict(klass='IntervalIndex',
|
| 41 | + qualname="IntervalIndex", |
41 | 42 | target_klass='IntervalIndex or list of Intervals',
|
42 | 43 | name=textwrap.dedent("""\
|
43 | 44 | name : object, optional
|
@@ -282,10 +283,10 @@ def contains(self, key):
|
282 | 283 | examples="""
|
283 | 284 | Examples
|
284 | 285 | --------
|
285 |
| - >>> idx = pd.IntervalIndex.from_arrays([0, np.nan, 2], [1, np.nan, 3]) |
286 |
| - >>> idx.to_tuples() |
| 286 | + >>> idx = pd.IntervalIndex.from_arrays([0, np.nan, 2], [1, np.nan, 3]) |
| 287 | + >>> idx.to_tuples() |
287 | 288 | Index([(0.0, 1.0), (nan, nan), (2.0, 3.0)], dtype='object')
|
288 |
| - >>> idx.to_tuples(na_tuple=False) |
| 289 | + >>> idx.to_tuples(na_tuple=False) |
289 | 290 | Index([(0.0, 1.0), nan, (2.0, 3.0)], dtype='object')""",
|
290 | 291 | ))
|
291 | 292 | def to_tuples(self, na_tuple=True):
|
@@ -1201,47 +1202,47 @@ def interval_range(start=None, end=None, periods=None, freq=None,
|
1201 | 1202 | Numeric ``start`` and ``end`` is supported.
|
1202 | 1203 |
|
1203 | 1204 | >>> pd.interval_range(start=0, end=5)
|
1204 |
| - IntervalIndex([(0, 1], (1, 2], (2, 3], (3, 4], (4, 5]] |
| 1205 | + IntervalIndex([(0, 1], (1, 2], (2, 3], (3, 4], (4, 5]], |
1205 | 1206 | closed='right', dtype='interval[int64]')
|
1206 | 1207 |
|
1207 | 1208 | Additionally, datetime-like input is also supported.
|
1208 | 1209 |
|
1209 | 1210 | >>> pd.interval_range(start=pd.Timestamp('2017-01-01'),
|
1210 |
| - end=pd.Timestamp('2017-01-04')) |
| 1211 | + ... end=pd.Timestamp('2017-01-04')) |
1211 | 1212 | IntervalIndex([(2017-01-01, 2017-01-02], (2017-01-02, 2017-01-03],
|
1212 |
| - (2017-01-03, 2017-01-04]] |
| 1213 | + (2017-01-03, 2017-01-04]], |
1213 | 1214 | closed='right', dtype='interval[datetime64[ns]]')
|
1214 | 1215 |
|
1215 | 1216 | The ``freq`` parameter specifies the frequency between the left and right.
|
1216 | 1217 | endpoints of the individual intervals within the ``IntervalIndex``. For
|
1217 | 1218 | numeric ``start`` and ``end``, the frequency must also be numeric.
|
1218 | 1219 |
|
1219 | 1220 | >>> pd.interval_range(start=0, periods=4, freq=1.5)
|
1220 |
| - IntervalIndex([(0.0, 1.5], (1.5, 3.0], (3.0, 4.5], (4.5, 6.0]] |
| 1221 | + IntervalIndex([(0.0, 1.5], (1.5, 3.0], (3.0, 4.5], (4.5, 6.0]], |
1221 | 1222 | closed='right', dtype='interval[float64]')
|
1222 | 1223 |
|
1223 | 1224 | Similarly, for datetime-like ``start`` and ``end``, the frequency must be
|
1224 | 1225 | convertible to a DateOffset.
|
1225 | 1226 |
|
1226 | 1227 | >>> pd.interval_range(start=pd.Timestamp('2017-01-01'),
|
1227 |
| - periods=3, freq='MS') |
| 1228 | + ... periods=3, freq='MS') |
1228 | 1229 | IntervalIndex([(2017-01-01, 2017-02-01], (2017-02-01, 2017-03-01],
|
1229 |
| - (2017-03-01, 2017-04-01]] |
| 1230 | + (2017-03-01, 2017-04-01]], |
1230 | 1231 | closed='right', dtype='interval[datetime64[ns]]')
|
1231 | 1232 |
|
1232 | 1233 | Specify ``start``, ``end``, and ``periods``; the frequency is generated
|
1233 | 1234 | automatically (linearly spaced).
|
1234 | 1235 |
|
1235 | 1236 | >>> pd.interval_range(start=0, end=6, periods=4)
|
1236 |
| - IntervalIndex([(0.0, 1.5], (1.5, 3.0], (3.0, 4.5], (4.5, 6.0]] |
| 1237 | + IntervalIndex([(0.0, 1.5], (1.5, 3.0], (3.0, 4.5], (4.5, 6.0]], |
1237 | 1238 | closed='right',
|
1238 | 1239 | dtype='interval[float64]')
|
1239 | 1240 |
|
1240 | 1241 | The ``closed`` parameter specifies which endpoints of the individual
|
1241 | 1242 | intervals within the ``IntervalIndex`` are closed.
|
1242 | 1243 |
|
1243 | 1244 | >>> pd.interval_range(end=5, periods=4, closed='both')
|
1244 |
| - IntervalIndex([[1, 2], [2, 3], [3, 4], [4, 5]] |
| 1245 | + IntervalIndex([[1, 2], [2, 3], [3, 4], [4, 5]], |
1245 | 1246 | closed='both', dtype='interval[int64]')
|
1246 | 1247 | """
|
1247 | 1248 | start = com.maybe_box_datetimelike(start)
|
|
0 commit comments