Pandas: Data Manipulation - timedelta_range() function

timedelta_range() function

The timedelta_range() function is used to concatenate pandas objects along a particular axis with optional set logic along the other axes.


pandas.timedelta_range(start=None, end=None, periods=None, freq=None, name=None, closed=None)[source]

Return a fixed frequency TimedeltaIndex, with day as the default frequency


Name Description Type Default Value Required / Optional
start  Left bound for generating timedeltas  string or timedelta-like None Required
end  Right bound for generating timedeltas string or timedelta-like None Required
periods Number of periods to generate


None Required
freq Frequency strings can have multiples, e.g. '5H' string or DateOffset ‘D’ Required
name Name of the resulting TimedeltaIndex string None Required
closed Make the interval closed with respect to the given frequency to the 'left', 'right', or both sides (None) string None Required

Returns: rng - TimedeltaIndex


Of the four parameters start, end, periods, and freq, exactly three must be specified. If freq is omitted, the resulting TimedeltaIndex will have periods linearly spaced elements between start and end (closed on both sides).


Download the above Notebook from here.

Previous: period_range() function
Next: interval_range() function