pandas.interval_range

pandas 3.1.1 · General functions · function

Construct an IntervalIndex with evenly spaced boundaries.

Call syntax

pd.interval_range(start=None, end=None, periods=None, freq=None, name=None, closed='right')

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
start Optional
Positional or keyword
Default None
numeric or datetime-like

Supply the start point of a range, slice, or calculation.

end Optional
Positional or keyword
Default None
numeric or datetime-like

Supply the endpoint of the range or calculation.

periods Optional
Positional or keyword
Default None
int

Set a count of generated observations or the number of steps to shift or compare.

freq Optional
Positional or keyword
Default None
numeric, str, Timedelta, datetime.timedelta, or DateOffset

Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start.

name Optional
Positional or keyword
Default None
str

Set a name or identify the named object used by the operation.

closed Optional
Positional or keyword
Default 'right'
{'left', 'right', 'both', 'neither'}

Choose which interval boundaries are included.

Returns

IntervalIndex