pandas 1.4.2

NotesParametersReturnsBackRef
timedelta_range(start=None, end=None, periods: 'int | None' = None, freq=None, name=None, closed=None) -> '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).

To learn more about the frequency strings, please see :None:None:`this link <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`.

Parameters

start : str or timedelta-like, default None

Left bound for generating timedeltas.

end : str or timedelta-like, default None

Right bound for generating timedeltas.

periods : int, default None

Number of periods to generate.

freq : str or DateOffset, default 'D'

Frequency strings can have multiples, e.g. '5H'.

name : str, default None

Name of the resulting TimedeltaIndex.

closed : str, default None

Make the interval closed with respect to the given frequency to the 'left', 'right', or both sides (None).

Returns

TimedeltaIndex

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

Examples

This example is valid syntax, but we were not able to check execution
>>> pd.timedelta_range(start='1 day', periods=4)
TimedeltaIndex(['1 days', '2 days', '3 days', '4 days'],
               dtype='timedelta64[ns]', freq='D')

The closed parameter specifies which endpoint is included. The default behavior is to include both endpoints.

This example is valid syntax, but we were not able to check execution
>>> pd.timedelta_range(start='1 day', periods=4, closed='right')
TimedeltaIndex(['2 days', '3 days', '4 days'],
               dtype='timedelta64[ns]', freq='D')

The freq parameter specifies the frequency of the TimedeltaIndex. Only fixed frequencies can be passed, non-fixed frequencies such as 'M' (month end) will raise.

This example is valid syntax, but we were not able to check execution
>>> pd.timedelta_range(start='1 day', end='2 days', freq='6H')
TimedeltaIndex(['1 days 00:00:00', '1 days 06:00:00', '1 days 12:00:00',
                '1 days 18:00:00', '2 days 00:00:00'],
               dtype='timedelta64[ns]', freq='6H')

Specify start , end , and periods ; the frequency is generated automatically (linearly spaced).

This example is valid syntax, but we were not able to check execution
>>> pd.timedelta_range(start='1 day', end='5 days', periods=4)
TimedeltaIndex(['1 days 00:00:00', '2 days 08:00:00', '3 days 16:00:00',
                '5 days 00:00:00'],
               dtype='timedelta64[ns]', freq=None)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.indexes.datetimes.date_range pandas.core.indexes.timedeltas.TimedeltaIndex

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/indexes/timedeltas.py#199
type: <class 'function'>
Commit: