pandas.Timedelta.ceil#

Timedelta.ceil(freq)#

Return a new Timedelta ceiled to this resolution.

Parameters:
freqstr

Frequency string indicating the ceiling resolution. Must be a fixed frequency like β€˜s’ (second) not β€˜ME’ (month end). See frequency aliases for a list of possible freq values.

Returns:
Timedelta

A new Timedelta object ceiled to the specified resolution.

See also

Timedelta.floor

Floor the Timedelta to the specified resolution.

Timedelta.round

Round the Timedelta to the nearest specified resolution.

Examples

>>> td = pd.Timedelta('1001ms')
>>> td
Timedelta('0 days 00:00:01.001000')
>>> td.ceil('s')
Timedelta('0 days 00:00:02')