w3resource

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.

Syntax:

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

Parameters:

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

integer

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

Notes

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).

Example:


Download the Pandas DataFrame Notebooks from here.

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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/pandas/timedelta_range.php