cudf.TimedeltaIndex#

class cudf.TimedeltaIndex(*args, **kwargs)[source]#

Immutable, ordered and sliceable sequence of timedelta64 data, represented internally as int64.

Parameters:
dataarray-like (1-dimensional), optional

Optional datetime-like data to construct index with.

copybool

Make a copy of input.

freqstr, optional

This is not yet supported

dtypestr or numpy.dtype, optional

Data type for the output Index. If not specified, the default dtype will be timedelta64[ns].

nameobject

Name to be stored in the index.

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

Infers frequency of TimedeltaIndex.

Methods

None

Returns:
TimedeltaIndex

Examples

>>> import cudf
>>> cudf.TimedeltaIndex([1132223, 2023232, 342234324, 4234324],
...     dtype="timedelta64[ns]")
TimedeltaIndex(['0 days 00:00:00.001132223', '0 days 00:00:00.002023232',
                '0 days 00:00:00.342234324', '0 days 00:00:00.004234324'],
              dtype='timedelta64[ns]')
>>> cudf.TimedeltaIndex([1, 2, 3, 4], dtype="timedelta64[s]",
...     name="delta-index")
TimedeltaIndex(['0 days 00:00:01', '0 days 00:00:02', '0 days 00:00:03',
                '0 days 00:00:04'],
              dtype='timedelta64[s]', name='delta-index')