Skip to content

CLN: Remove deprecated method #22324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions doc/source/timeseries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,6 @@ resulting ``DatetimeIndex``:
Custom Frequency Ranges
~~~~~~~~~~~~~~~~~~~~~~~

.. warning::

This functionality was originally exclusive to ``cdate_range``, which is
deprecated as of version 0.21.0 in favor of ``bdate_range``. Note that
``cdate_range`` only utilizes the ``weekmask`` and ``holidays`` parameters
when custom business day, 'C', is passed as the frequency string. Support has
been expanded with ``bdate_range`` to work with any custom frequency string.

.. versionadded:: 0.21.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line can be removed as well.


``bdate_range`` can also generate a range of custom frequency dates by using
Expand Down
59 changes: 0 additions & 59 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,65 +1790,6 @@ def bdate_range(start=None, end=None, periods=None, freq='B', tz=None,
closed=closed, **kwargs)


def cdate_range(start=None, end=None, periods=None, freq='C', tz=None,
normalize=True, name=None, closed=None, **kwargs):
"""
Return a fixed frequency DatetimeIndex, with CustomBusinessDay as the
default frequency

.. deprecated:: 0.21.0

Parameters
----------
start : string or datetime-like, default None
Left bound for generating dates
end : string or datetime-like, default None
Right bound for generating dates
periods : integer, default None
Number of periods to generate
freq : string or DateOffset, default 'C' (CustomBusinessDay)
Frequency strings can have multiples, e.g. '5H'
tz : string, default None
Time zone name for returning localized DatetimeIndex, for example
Asia/Beijing
normalize : bool, default False
Normalize start/end dates to midnight before generating date range
name : string, default None
Name of the resulting DatetimeIndex
weekmask : string, Default 'Mon Tue Wed Thu Fri'
weekmask of valid business days, passed to ``numpy.busdaycalendar``
holidays : list
list/array of dates to exclude from the set of valid business days,
passed to ``numpy.busdaycalendar``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the implementation, although they may not be explicit parameters, but they should be documented. Not sure if plain removal is the right move here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh apologies I looked at bdate_range and saw they where optional params there opposed to kwargs. It's a deprecated method anyway, but how about documenting it something like below So its clear they are kwargs?

closed : string, default None
    Make the interval closed with respect to the given frequency to
    the 'left', 'right', or both sides (None)
**weekmask : string, Default 'Mon Tue Wed Thu Fri'
    weekmask of valid business days, passed to ``numpy.busdaycalendar``
**holidays : list
    list/array of dates to exclude from the set of valid business days,
    passed to ``numpy.busdaycalendar``

Copy link
Member

@gfyoung gfyoung Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'll do you one better. Let's just remove it (it's been long enough).

How does that sound?

closed : string, default None
Make the interval closed with respect to the given frequency to
the 'left', 'right', or both sides (None)

Notes
-----
Of the three parameters: ``start``, ``end``, and ``periods``, exactly two
must be specified.

To learn more about the frequency strings, please see `this link
<http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.

Returns
-------
rng : DatetimeIndex
"""
warnings.warn("cdate_range is deprecated and will be removed in a future "
"version, instead use pd.bdate_range(..., freq='{freq}')"
.format(freq=freq), FutureWarning, stacklevel=2)

if freq == 'C':
holidays = kwargs.pop('holidays', [])
weekmask = kwargs.pop('weekmask', 'Mon Tue Wed Thu Fri')
freq = CDay(holidays=holidays, weekmask=weekmask)
return DatetimeIndex(start=start, end=end, periods=periods, freq=freq,
tz=tz, normalize=normalize, name=name,
closed=closed, **kwargs)


_CACHE_START = Timestamp(datetime(1950, 1, 1))
_CACHE_END = Timestamp(datetime(2030, 1, 1))

Expand Down
10 changes: 0 additions & 10 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,6 @@ def test_deprecation_access_func(self):
ignore_order=True)


class TestCDateRange(object):

def test_deprecation_cdaterange(self):
# GH17596
from pandas.core.indexes.datetimes import cdate_range
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
cdate_range('2017-01-01', '2017-12-31')


class TestCategoricalMove(object):

def test_categorical_move(self):
Expand Down