pyspark.pandas.DatetimeIndex.round¶
-
DatetimeIndex.
round
(freq: Union[str, pandas._libs.tslibs.offsets.DateOffset], *args: Any, **kwargs: Any) → pyspark.pandas.indexes.datetimes.DatetimeIndex[source]¶ Perform round operation on the data to the specified freq.
- Parameters
- freqstr or Offset
The frequency level to round the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end).
- Returns
- DatetimeIndex
- Raises
- ValueError if the freq cannot be converted.
Examples
>>> rng = ps.date_range('1/1/2018 11:59:00', periods=3, freq='min') >>> rng.round("H") DatetimeIndex(['2018-01-01 12:00:00', '2018-01-01 12:00:00', '2018-01-01 12:00:00'], dtype='datetime64[ns]', freq=None)