Table Of Contents


Enter search terms or a module, class or function name.


Series.dt.floor(*args, **kwargs)[source]

floor the data to the specified freq.


freq : str or Offset

The frequency level to floor the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end). See frequency aliases for a list of possible freq values.

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

Only relevant for DatetimeIndex:

  • ‘infer’ will attempt to infer fall dst-transition hours based on order
  • bool-ndarray where True signifies a DST time, False designates a non-DST time (note that this flag is only applicable for ambiguous times)
  • ‘NaT’ will return NaT where there are ambiguous times
  • ‘raise’ will raise an AmbiguousTimeError if there are ambiguous times

New in version 0.24.0.

nonexistent : ‘shift’, ‘NaT’, default ‘raise’

A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.

  • ‘shift’ will shift the nonexistent time forward to the closest existing time
  • ‘NaT’ will return NaT where there are nonexistent times
  • ‘raise’ will raise an NonExistentTimeError if there are nonexistent times

New in version 0.24.0.


DatetimeIndex, TimedeltaIndex, or Series

Index of the same type for a DatetimeIndex or TimedeltaIndex, or a Series with the same index for a Series.

ValueError if the `freq` cannot be converted.



>>> rng = pd.date_range('1/1/2018 11:59:00', periods=3, freq='min')
>>> rng
DatetimeIndex(['2018-01-01 11:59:00', '2018-01-01 12:00:00',
               '2018-01-01 12:01:00'],
              dtype='datetime64[ns]', freq='T')
>>> rng.floor('H')
DatetimeIndex(['2018-01-01 11:00:00', '2018-01-01 12:00:00',
               '2018-01-01 12:00:00'],
              dtype='datetime64[ns]', freq=None)


>>> pd.Series(rng).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]
Scroll To Top