dt.
floor
Perform floor operation on the data to the specified freq.
The frequency level to floor the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end).
A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.
‘shift_forward’ will shift the nonexistent time forward to the closest existing time
‘shift_backward’ will shift the nonexistent time backward to the closest existing time
‘NaT’ will return NaT where there are nonexistent times
timedelta objects will shift nonexistent times by the timedelta
‘raise’ will raise an NonExistentTimeError if there are nonexistent times
Note
this option only works with pandas 0.24.0+
a Series with the same index for a Series.
Examples
>>> series = ps.Series(pd.date_range('1/1/2018 11:59:00', periods=3, freq='min')) >>> series 0 2018-01-01 11:59:00 1 2018-01-01 12:00:00 2 2018-01-01 12:01:00 dtype: datetime64[ns]
>>> series.dt.floor("H") 0 2018-01-01 11:00:00 1 2018-01-01 12:00:00 2 2018-01-01 12:00:00 dtype: datetime64[ns]