Pandas array for interval data that are closed on the same side.
Array-like (ndarray, DateTimeArray, TimeDeltaArray) containing Interval objects from which to build the IntervalArray.
Whether the intervals are closed on the left-side, right-side, both or neither.
If None, dtype will be inferred.
Copy the input data.
Verify that the IntervalArray is valid.
Attributes
Return the left endpoints of each Interval in the IntervalArray as an Index. | |
Return the right endpoints of each Interval in the IntervalArray as an Index. | |
String describing the inclusive side the intervals. | |
Return the midpoint of each Interval in the IntervalArray as an Index. | |
Return an Index with entries denoting the length of each Interval. | |
Indicates if an interval is empty, meaning it contains no points. | |
Return a boolean whether the IntervalArray is non-overlapping and monotonic. |
Methods
| Construct from two arrays defining the left and right bounds. |
| Construct an IntervalArray from an array-like of tuples. |
| Construct an IntervalArray from an array of splits. |
| Check elementwise if the Intervals contain the value. |
| Check elementwise if an Interval overlaps the values in the IntervalArray. |
| Return an identical IntervalArray closed on the specified side. |
| Return an ndarray (if self is IntervalArray) or Index (if self is IntervalIndex) of tuples of the form (left, right). |
See also
IndexThe base pandas Index type.
IntervalA bounded slice-like interval; the elements of an IntervalArray.
interval_rangeFunction to create a fixed frequency IntervalIndex.
cutBin values into discrete Intervals.
qcutBin values into equal-sized Intervals based on rank or sample quantiles.
Notes
See the user guide for more.
Examples
A new IntervalArray can be constructed directly from an array-like of Interval objects:
>>> pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
<IntervalArray>
[(0, 1], (1, 5]]
Length: 2, dtype: interval[int64, right]
It may also be constructed using one of the constructor methods: IntervalArray.from_arrays(), IntervalArray.from_breaks(), and IntervalArray.from_tuples().
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.arrays.IntervalArray.html