pandas.IntervalIndex¶
-
class
pandas.
IntervalIndex
[source]¶ Immutable Index implementing an ordered, sliceable set. IntervalIndex represents an Index of intervals that are all closed on the same side.
New in version 0.20.0.
Warning
The indexing behaviors are provisional and may change in a future version of pandas.
See also
Index
- The base pandas Index type
Interval
- A bounded slice-like interval
interval_range
- Function to create a fixed frequency
IntervalIndex
,IntervalIndex.from_arrays
,IntervalIndex.from_breaks
,IntervalIndex.from_intervals
,IntervalIndex.from_tuples
,cut
,qcut
Notes
See the user guide for more.
Examples
A new
IntervalIndex
is typically constructed usinginterval_range()
:>>> pd.interval_range(start=0, end=5) IntervalIndex([(0, 1], (1, 2], (2, 3], (3, 4], (4, 5]] closed='right', dtype='interval[int64]')
It may also be constructed using one of the constructor methods
IntervalIndex.from_arrays()
,IntervalIndex.from_breaks()
,IntervalIndex.from_intervals()
andIntervalIndex.from_tuples()
.See further examples in the doc strings of
interval_range
and the mentioned constructor methods.