Skip to content

Commit b0213f4

Browse files
Update docstring by removing old logic and adding depr notice
1 parent ba76c2c commit b0213f4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pandas/core/tools/timedeltas.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ def to_timedelta(arg, unit=None, errors="raise"):
2626
Parameters
2727
----------
2828
arg : str, timedelta, list-like or Series
29-
The data to be converted to timedelta. The character M by itself,
30-
e.g. '1M', is treated as minute, not month. The characters Y and y
31-
are treated as the mean length of the Gregorian calendar year -
32-
365.2425 days or 365 days 5 hours 49 minutes 12 seconds.
29+
The data to be converted to timedelta.
30+
31+
.. deprecated:: 1.2
32+
Strings denoting units with 'M', 'Y', 'm' and 'y' do not represent
33+
unambiguous timedelta values durations and will removed in a future
34+
version
35+
3336
unit : str, optional
3437
Denotes the unit of the arg for numeric `arg`. Defaults to ``"ns"``.
3538
@@ -126,8 +129,8 @@ def to_timedelta(arg, unit=None, errors="raise"):
126129
)
127130
elif arg.upper().endswith(" M") or arg.upper().endswith(" Y"):
128131
warnings.warn(
129-
"'M', 'Y', 'm' and 'y' do not represent unambiguous timedelta values"
130-
" durations. and will removed in a future version",
132+
"Denoting units with 'M', 'Y', 'm' and 'y' do not represent unambiguous"
133+
" timedelta values durations and will removed in a future version",
131134
FutureWarning,
132135
stacklevel=2,
133136
)

0 commit comments

Comments
 (0)