pandas.Timedelta.floor#
- Timedelta.floor(freq)#
Return a new Timedelta floored to this resolution.
Truncates the Timedelta to the nearest multiple of the given frequency, rounding toward negative infinity.
- Parameters:
- freqstr or timedelta
Frequency string or timedelta value indicating the flooring resolution. It uses the same units as class constructor
Timedelta.
- Returns:
- Timedelta
A new Timedelta object floored to the specified resolution.
See also
Timedelta.ceilCeil the Timedelta to the specified resolution.
Timedelta.roundRound the Timedelta to the specified resolution.
Timestamp.floorSimilar method for Timestamp objects.
Examples
>>> td = pd.Timedelta('1001ms') >>> td Timedelta('0 days 00:00:01.001000') >>> td.floor('s') Timedelta('0 days 00:00:01')
freqcan also be a timedelta value:>>> td.floor(freq=pd.Timedelta('1s')) Timedelta('0 days 00:00:01')