Skip to content

Commit a645535

Browse files
committed
fixed docstring of timedelta.ceil to match docstring of datetimeindex.ceil
1 parent 2a10e04 commit a645535

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,11 @@ class Timedelta(_Timedelta):
21092109
"""
21102110
Round the Timedelta to the specified resolution.
21112111
2112+
This method rounds the Timedelta to the nearest specified frequency.
2113+
It is useful for aligning time durations to regular intervals,
2114+
such as seconds, minutes, or hours, ensuring that the resulting
2115+
Timedelta is expressed in fixed units.
2116+
21122117
Parameters
21132118
----------
21142119
freq : str
@@ -2143,6 +2148,11 @@ class Timedelta(_Timedelta):
21432148
"""
21442149
Return a new Timedelta floored to this resolution.
21452150
2151+
This method truncates the Timedelta to the nearest specified frequency,
2152+
effectively rounding down the duration to the nearest interval defined
2153+
by the provided frequency string. This is useful for situations where
2154+
you want to ensure that the Timedelta does not exceed a certain duration.
2155+
21462156
Parameters
21472157
----------
21482158
freq : str
@@ -2173,11 +2183,17 @@ class Timedelta(_Timedelta):
21732183
"""
21742184
Return a new Timedelta ceiled to this resolution.
21752185
2186+
This method rounds up the Timedelta to the nearest specified frequency,
2187+
ensuring that the result represents a valid time duration aligned with
2188+
the given frequency.
2189+
21762190
Parameters
21772191
----------
21782192
freq : str
2179-
Frequency string indicating the ceiling resolution.
2180-
It uses the same units as class constructor :class:`~pandas.Timedelta`.
2193+
The frequency level to ceil the index to. Must be a fixed
2194+
frequency like ‘S’ (second) not ‘ME’ (month end).
2195+
See :ref:`frequency aliases <timeseries.offset_aliases>`
2196+
for a list of possible `freq` values.
21812197
21822198
Returns
21832199
-------

0 commit comments

Comments
 (0)