pandas.Timedelta.round — pandas 3.0.0.dev0+2103.g41968a550a documentation (original) (raw)
Timedelta.round(freq)#
Round the Timedelta to the specified resolution.
Parameters:
freqstr
Frequency string indicating the rounding resolution. It uses the same units as class constructor Timedelta.
Returns:
a new Timedelta rounded to the given resolution of freq
Raises:
ValueError if the freq cannot be converted
See also
Floor the Timedelta to the specified resolution.
Round the Timedelta to the nearest specified resolution.
Similar method for Timestamp objects.
Examples
td = pd.Timedelta('1001ms') td Timedelta('0 days 00:00:01.001000') td.round('s') Timedelta('0 days 00:00:01')