Skip to content

Commit a89f208

Browse files
authored
CLN: unify a ValueError message for removed units T, L, U, N and remove these entries from UnitChoices (pandas-dev#59119)
cln: change msg in ValueError for units T, L, U, N
1 parent 750d75e commit a89f208

File tree

4 files changed

+0
-22
lines changed

4 files changed

+0
-22
lines changed

pandas/_libs/tslibs/dtypes.pyx

-4
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,6 @@ class Resolution(Enum):
453453
"""
454454
cdef:
455455
str abbrev
456-
if freq in {"T", "t", "L", "l", "U", "u", "N", "n"}:
457-
raise ValueError(
458-
f"Frequency \'{freq}\' is no longer supported."
459-
)
460456
try:
461457
if freq in c_DEPR_ABBREVS:
462458
abbrev = c_DEPR_ABBREVS[freq]

pandas/_libs/tslibs/timedeltas.pyi

-6
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ UnitChoices: TypeAlias = Literal[
3939
"minute",
4040
"min",
4141
"minutes",
42-
"T",
43-
"t",
4442
"s",
4543
"seconds",
4644
"sec",
@@ -50,21 +48,17 @@ UnitChoices: TypeAlias = Literal[
5048
"millisecond",
5149
"milli",
5250
"millis",
53-
"L",
54-
"l",
5551
"us",
5652
"microseconds",
5753
"microsecond",
5854
"µs",
5955
"micro",
6056
"micros",
61-
"u",
6257
"ns",
6358
"nanoseconds",
6459
"nano",
6560
"nanos",
6661
"nanosecond",
67-
"n",
6862
]
6963
_S = TypeVar("_S", bound=timedelta)
7064

pandas/_libs/tslibs/timedeltas.pyx

-5
Original file line numberDiff line numberDiff line change
@@ -1818,11 +1818,6 @@ class Timedelta(_Timedelta):
18181818
* 'microseconds', 'microsecond', 'micros', 'micro', or 'us'
18191819
* 'nanoseconds', 'nanosecond', 'nanos', 'nano', or 'ns'.
18201820
1821-
.. deprecated:: 2.2.0
1822-
1823-
Values `H`, `T`, `S`, `L`, `U`, and `N` are deprecated in favour
1824-
of the values `h`, `min`, `s`, `ms`, `us`, and `ns`.
1825-
18261821
.. deprecated:: 3.0.0
18271822
18281823
Allowing the values `w`, `d`, `MIN`, `MS`, `US` and `NS` to denote units

pandas/tests/tslibs/test_resolution.py

-7
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,3 @@ def test_units_H_S_deprecated_from_attrname_to_abbrevs(freq):
5656

5757
with tm.assert_produces_warning(FutureWarning, match=msg):
5858
Resolution.get_reso_from_freqstr(freq)
59-
60-
61-
@pytest.mark.parametrize("freq", ["T", "t", "L", "U", "N", "n"])
62-
def test_reso_abbrev_T_L_U_N_raises(freq):
63-
msg = f"Frequency '{freq}' is no longer supported."
64-
with pytest.raises(ValueError, match=msg):
65-
Resolution.get_reso_from_freqstr(freq)

0 commit comments

Comments
 (0)