pandas.timedelta_range

pandas 3.1.1 · General functions · function

Build a TimedeltaIndex at fixed increments between specified boundaries.

Call syntax

pd.timedelta_range(…) Full signature
pd.timedelta_range(
    start=None,
    end=None,
    periods=None,
    freq=None,
    name=None,
    closed=None,
    *,
    unit=None,
)

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
str or timedelta-like

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

end Optional
Positional or keyword
Default None
str or timedelta-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
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
Hashable

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

closed Optional
Positional or keyword
Default None
str

Choose which interval boundaries are included.

unit Optional
Keyword only
Default None
{'s', 'ms', 'us', 'ns', None}

Specify the time unit represented by each number or required by the result.

Returns

TimedeltaIndex