Table Of Contents

Search

Enter search terms or a module, class or function name.

pandas.TimedeltaIndex

class pandas.TimedeltaIndex[source]

Immutable ndarray of timedelta64 data, represented internally as int64, and which can be boxed to timedelta objects

Parameters:

data : array-like (1-dimensional), optional

Optional timedelta-like data to construct index with

unit: unit of the arg (D,h,m,s,ms,us,ns) denote the unit, optional

which is an integer/float number

freq: a frequency for the index, optional

copy : bool

Make a copy of input ndarray

start : starting value, timedelta-like, optional

If data is None, start is used as the start point in generating regular timedelta data.

periods : int, optional, > 0

Number of periods to generate, if generating index. Takes precedence over end argument

end : end time, timedelta-like, optional

If periods is none, generated index will extend to first conforming time on or just past end argument

closed : string or None, default None

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

name : object

Name to be stored in the index

See also

Index
The base pandas Index type
Timedelta
Represents a duration between two dates or times.
DatetimeIndex
Index of datetime64 data
PeriodIndex
Index of Period data

Notes

To learn more about the frequency strings, please see this link.

Attributes

days Number of days for each element.
seconds Number of seconds (>= 0 and less than 1 day) for each element.
microseconds Number of microseconds (>= 0 and less than 1 second) for each element.
nanoseconds Number of nanoseconds (>= 0 and less than 1 microsecond) for each element.
components Return a dataframe of the components (days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas.
inferred_freq

Methods

to_pytimedelta() Return TimedeltaIndex as object ndarray of datetime.timedelta objects
to_series(**kwargs) Create a Series with both index and values equal to the index keys
round(freq, *args, **kwargs) round the index to the specified freq
floor(freq) floor the index to the specified freq
ceil(freq) ceil the index to the specified freq
to_frame([index]) Create a DataFrame with a column containing the Index.
Scroll To Top