cudf.DatetimeIndex#

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

Immutable , ordered and sliceable sequence of datetime64 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

Frequency of the DatetimeIndex

tzpytz.timezone or dateutil.tz.tzfile

This is not yet supported

ambiguous‘infer’, bool-ndarray, ‘NaT’, default ‘raise’

This is not yet supported

nameobject

Name to be stored in the index.

dayfirstbool, default False

If True, parse dates in data with the day first order. This is not yet supported

yearfirstbool, default False

If True parse dates in data with the year first order. This is not yet supported

Attributes

year

The year of the datetime.

month

The month as January=1, December=12.

day

The day of the datetime.

hour

The hours of the datetime.

minute

The minutes of the datetime.

second

The seconds of the datetime.

microsecond

The microseconds of the datetime.

nanosecond

The nanoseconds of the datetime.

date

Returns numpy array of python datetime.date objects.

time

Returns numpy array of datetime.time objects.

dayofyear

The day of the year, from 1-365 in non-leap years and from 1-366 in leap years.

day_of_year

The day of the year, from 1-365 in non-leap years and from 1-366 in leap years.

weekday

The day of the week with Monday=0, Sunday=6.

quarter

Integer indicator for which quarter of the year the date belongs in.

freq

Methods

ceil(freq)

Perform ceil operation on the data to the specified freq.

floor(freq)

Perform floor operation on the data to the specified freq.

round(freq)

Perform round operation on the data to the specified freq.

tz_convert(tz)

Convert tz-aware datetimes from one time zone to another.

tz_localize(tz[, ambiguous, nonexistent])

Localize timezone-naive data to timezone-aware data.

Returns:
DatetimeIndex

Examples

>>> import cudf
>>> cudf.DatetimeIndex([1, 2, 3, 4], name="a")
DatetimeIndex(['1970-01-01 00:00:00.000000001',
               '1970-01-01 00:00:00.000000002',
               '1970-01-01 00:00:00.000000003',
               '1970-01-01 00:00:00.000000004'],
              dtype='datetime64[ns]', name='a')