Skip to content

Commit efc9e82

Browse files
committed
CLN: Remove tseries v0.19.0 deprecations
* Remove frequencies.get_standard_freq * Drop the "freqstr" keyword from frequencies.to_offset Deprecated in v0.19.0 xref pandas-devgh-13874
1 parent cfa5ea6 commit efc9e82

File tree

4 files changed

+4
-49
lines changed

4 files changed

+4
-49
lines changed

doc/source/whatsnew/v0.23.0.txt

+2
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ Removal of prior version deprecations/changes
247247
- :func:`read_csv` has dropped the ``compact_ints`` and ``use_unsigned`` parameters (:issue:`13323`)
248248
- The ``Timestamp`` class has dropped the ``offset`` attribute in favor of ``freq`` (:issue:`13593`)
249249
- The ``Series``, ``Categorical``, and ``Index`` classes have dropped the ``reshape`` method (:issue:`13012`)
250+
- ``pandas.tseries.frequencies.get_standard_freq`` has been removed in favor of ``pandas.tseries.frequencies.to_offset(freq).rule_code`` (:issue:`13874`)
251+
- The ``freqstr`` keyword has been removed from ``pandas.tseries.frequencies.to_offset`` in favor of ``freq`` (:issue:`13874`)
250252

251253
.. _whatsnew_0230.performance:
252254

pandas/tests/tseries/offsets/test_offsets.py

+2-30
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
from pandas.compat.numpy import np_datetime64_compat
1212

1313
from pandas.core.series import Series
14-
from pandas.tseries.frequencies import (_offset_map, get_freq_code,
15-
_get_freq_str, _INVALID_FREQ_ERROR,
16-
get_offset, get_standard_freq)
14+
from pandas.tseries.frequencies import (_offset_map, get_freq_code, get_offset,
15+
_get_freq_str, _INVALID_FREQ_ERROR)
1716
from pandas.core.indexes.datetimes import (
1817
_to_m8, DatetimeIndex, _daterange_cache)
1918
import pandas._libs.tslibs.offsets as liboffsets
@@ -2786,33 +2785,6 @@ def test_get_offset_legacy():
27862785
get_offset(name)
27872786

27882787

2789-
def test_get_standard_freq():
2790-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2791-
fstr = get_standard_freq('W')
2792-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2793-
assert fstr == get_standard_freq('w')
2794-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2795-
assert fstr == get_standard_freq('1w')
2796-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2797-
assert fstr == get_standard_freq(('W', 1))
2798-
2799-
with tm.assert_raises_regex(ValueError, _INVALID_FREQ_ERROR):
2800-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2801-
get_standard_freq('WeEk')
2802-
2803-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2804-
fstr = get_standard_freq('5Q')
2805-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2806-
assert fstr == get_standard_freq('5q')
2807-
2808-
with tm.assert_raises_regex(ValueError, _INVALID_FREQ_ERROR):
2809-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2810-
get_standard_freq('5QuarTer')
2811-
2812-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
2813-
assert fstr == get_standard_freq(('q', 5))
2814-
2815-
28162788
class TestOffsetAliases(object):
28172789

28182790
def setup_method(self, method):

pandas/tests/tseries/test_frequencies.py

-4
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,6 @@ def test_frequency_misc(self):
551551
with tm.assert_raises_regex(ValueError, 'Could not evaluate'):
552552
frequencies.to_offset(('', ''))
553553

554-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
555-
result = frequencies.get_standard_freq(offsets.Hour())
556-
assert result == 'H'
557-
558554

559555
_dti = DatetimeIndex
560556

pandas/tseries/frequencies.py

-15
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from pandas.compat import zip
44
from pandas import compat
55
import re
6-
import warnings
76

87
import numpy as np
98

@@ -14,7 +13,6 @@
1413
is_datetime64_dtype)
1514

1615
from pandas.tseries.offsets import DateOffset
17-
from pandas.util._decorators import deprecate_kwarg
1816
import pandas.tseries.offsets as offsets
1917

2018
from pandas._libs.tslib import Timedelta
@@ -143,7 +141,6 @@ def get_period_alias(offset_str):
143141
'nanoseconds': Nano(1)}
144142

145143

146-
@deprecate_kwarg(old_arg_name='freqstr', new_arg_name='freq')
147144
def to_offset(freq):
148145
"""
149146
Return DateOffset object from string or tuple representation
@@ -294,18 +291,6 @@ def get_offset(name):
294291

295292
getOffset = get_offset
296293

297-
298-
def get_standard_freq(freq):
299-
"""
300-
Return the standardized frequency string
301-
"""
302-
303-
msg = ("get_standard_freq is deprecated. Use to_offset(freq).rule_code "
304-
"instead.")
305-
warnings.warn(msg, FutureWarning, stacklevel=2)
306-
return to_offset(freq).rule_code
307-
308-
309294
# ---------------------------------------------------------------------
310295
# Period codes
311296

0 commit comments

Comments
 (0)