cudf.DatetimeIndex.round#
- DatetimeIndex.round(freq)[source]#
Perform round operation on the data to the specified freq.
- Parameters:
- freqstr
One of [“D”, “H”, “T”, “min”, “S”, “L”, “ms”, “U”, “us”, “N”]. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end). See frequency aliases for more details on these aliases.
- Returns:
- DatetimeIndex
Index containing rounded datetimes.
Examples
>>> import cudf >>> dt_idx = cudf.Index([ ... "2001-01-01 00:04:45", ... "2001-01-01 00:04:58", ... "2001-01-01 00:05:04", ... ], dtype="datetime64[ns]") >>> dt_idx DatetimeIndex(['2001-01-01 00:04:45', '2001-01-01 00:04:58', '2001-01-01 00:05:04'], dtype='datetime64[ns]') >>> dt_idx.round('H') DatetimeIndex(['2001-01-01', '2001-01-01', '2001-01-01'], dtype='datetime64[ns]') >>> dt_idx.round('T') DatetimeIndex(['2001-01-01 00:05:00', '2001-01-01 00:05:00', '2001-01-01 00:05:00'], dtype='datetime64[ns]')