Skip to content

Commit

Permalink
CLN: Remove tseries v0.19.0 deprecations
Browse files Browse the repository at this point in the history
* Remove frequencies.get_standard_freq
* Drop the "freqstr" keyword from frequencies.to_offset

Deprecated in v0.19.0

xref pandas-devgh-13874
  • Loading branch information
gfyoung committed Jan 1, 2018
1 parent f94b1d8 commit 8dff014
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 48 deletions.
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.23.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ Removal of prior version deprecations/changes
- The ``Timestamp`` class has dropped the ``offset`` attribute in favor of ``freq`` (:issue:`13593`)
- The ``Series``, ``Categorical``, and ``Index`` classes have dropped the ``reshape`` method (:issue:`13012`)
- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
- ``pandas.tseries.frequencies.get_standard_freq`` has been removed in favor of ``pandas.tseries.frequencies.to_offset(freq).rule_code`` (:issue:`13874`)
- The ``freqstr`` keyword has been removed from ``pandas.tseries.frequencies.to_offset`` in favor of ``freq`` (:issue:`13874`)

.. _whatsnew_0230.performance:

Expand Down
32 changes: 2 additions & 30 deletions pandas/tests/tseries/offsets/test_offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from pandas.compat.numpy import np_datetime64_compat

from pandas.core.series import Series
from pandas.tseries.frequencies import (_offset_map, get_freq_code,
_get_freq_str, _INVALID_FREQ_ERROR,
get_offset, get_standard_freq)
from pandas.tseries.frequencies import (_offset_map, get_freq_code, get_offset,
_get_freq_str, _INVALID_FREQ_ERROR)
from pandas.core.indexes.datetimes import (
_to_m8, DatetimeIndex, _daterange_cache)
import pandas._libs.tslibs.offsets as liboffsets
Expand Down Expand Up @@ -2786,33 +2785,6 @@ def test_get_offset_legacy():
get_offset(name)


def test_get_standard_freq():
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
fstr = get_standard_freq('W')
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
assert fstr == get_standard_freq('w')
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
assert fstr == get_standard_freq('1w')
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
assert fstr == get_standard_freq(('W', 1))

with tm.assert_raises_regex(ValueError, _INVALID_FREQ_ERROR):
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
get_standard_freq('WeEk')

with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
fstr = get_standard_freq('5Q')
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
assert fstr == get_standard_freq('5q')

with tm.assert_raises_regex(ValueError, _INVALID_FREQ_ERROR):
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
get_standard_freq('5QuarTer')

with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
assert fstr == get_standard_freq(('q', 5))


class TestOffsetAliases(object):

def setup_method(self, method):
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/tseries/test_frequencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,6 @@ def test_frequency_misc(self):
with tm.assert_raises_regex(ValueError, 'Could not evaluate'):
frequencies.to_offset(('', ''))

with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
result = frequencies.get_standard_freq(offsets.Hour())
assert result == 'H'


_dti = DatetimeIndex

Expand Down
14 changes: 0 additions & 14 deletions pandas/tseries/frequencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
is_datetime64_dtype)

from pandas.tseries.offsets import DateOffset
from pandas.util._decorators import deprecate_kwarg
import pandas.tseries.offsets as offsets

from pandas._libs.tslib import Timedelta
Expand Down Expand Up @@ -143,7 +142,6 @@ def get_period_alias(offset_str):
'nanoseconds': Nano(1)}


@deprecate_kwarg(old_arg_name='freqstr', new_arg_name='freq')
def to_offset(freq):
"""
Return DateOffset object from string or tuple representation
Expand Down Expand Up @@ -294,18 +292,6 @@ def get_offset(name):

getOffset = get_offset


def get_standard_freq(freq):
"""
Return the standardized frequency string
"""

msg = ("get_standard_freq is deprecated. Use to_offset(freq).rule_code "
"instead.")
warnings.warn(msg, FutureWarning, stacklevel=2)
return to_offset(freq).rule_code


# ---------------------------------------------------------------------
# Period codes

Expand Down

0 comments on commit 8dff014

Please sign in to comment.