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.ceil

Ceil the Timedelta to the specified resolution.

Timedelta.round

Round the Timedelta to the specified resolution.

Timestamp.floor

Similar 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')

freq can also be a timedelta value:

>>> td.floor(freq=pd.Timedelta('1s'))
Timedelta('0 days 00:00:01')