Examples
Numeric start and end is supported.
import numpy as np
import pandas as pd
pd.interval_range(start=0, end=6)
Additionally, datetime-like input is also supported.
pd.interval_range(start=pd.Timestamp('2019-02-02'),
end=pd.Timestamp('2019-02-04'))
The freq parameter specifies the frequency between the left and right. endpoints of the individual intervals
within the IntervalIndex. For numeric start and end, the frequency must also be numeric.
pd.interval_range(start=1, periods=5, freq=1.2)
Similarly, for datetime-like start and end, the frequency must be convertible to a DateOffset.
pd.interval_range(start=pd.Timestamp('2019-02-02'),
periods=4, freq='MS')
Specify start, end, and periods; the frequency is generated automatically (linearly spaced).
pd.interval_range(start=0, end=5, periods=4)
The closed parameter specifies which endpoints of the individual intervals within the IntervalIndex
are closed.
pd.interval_range(end=6, periods=6, closed='both')