8000 DEPR: Deprecate cdate_range and merge into bdate_range by jschendel · Pull Request #17691 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

DEPR: Deprecate cdate_range and merge into bdate_range #17691

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

Merged
merged 3 commits into from
Oct 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
review updates 2
  • Loading branch information
jschendel committed Oct 2, 2017
commit 4cbf70d53ab82360aecc265b4c966d1ab2cc078d
16 changes: 8 additions & 8 deletions doc/source/timeseries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,14 @@ of those specified will not be generated:
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

``bdate_range`` can also generate a range of custom frequency dates by using
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 if you indent this paragraph, it more 'belongs' to the versionadded directive (although not fully sure how it will look like when rendered)

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried indenting and it rendered everything on the same line, i.e. "New in version 0.21.0: bdate_range can also...". I changed it back to make it consistent with the other usages of versionadded within timeseries.rst and other documentation.

Expand All @@ -415,14 +423,6 @@ used if a custom frequency string is passed.

pd.bdate_range(start, end, freq='CBMS', weekmask=weekmask)

.. wa 8000 rning::

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.

.. seealso::

:ref:`timeseries.custombusinessdays`
Expand Down
10 changes: 10 additions & 0 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,13 @@ def test_deprecation_access_func(self):
[c1, c2],
sort_categories=True,
ignore_order=True)


class TestCDateRange(object):

def test_deprecation_cdaterange(self):
# GH17596
from pandas.core.indexes.datetimes import cdate_range
Copy link
Contributor

Choose a reason for hiding this comment

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

import from pandas here (we are actually testing the pd. deprecation); in this case they are the same, but its our practice to use the one we are deprecating.

Copy link
Member

Choose a reason for hiding this comment

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

no, we are testing this one (the move to top-level pd namespace was only very recently in master, so we don't have to deprecate that. That one we just removed, and we are deprecating the actual nested one)

Copy link
Contributor
@jreback jreback Oct 2, 2017

Choose a reason for hiding this comment

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

oh, ok then; guess we moved this in 0.21.0, so this is fine then.

with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
cdate_range('2017-01-01', '2017-12-31')
6 changes: 0 additions & 6 deletions pandas/tests/indexes/datetimes/test_date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import pandas as pd
import pandas.util.testing as tm
from pandas import compat
from pandas.core.indexes.datetimes import cdate_range
from pandas import date_range, bdate_range, offsets, DatetimeIndex, Timestamp
from pandas.tseries.offsets import (generate_range, CDay, BDay, DateOffset,
MonthEnd, prefix_mapping)
Expand Down Expand Up @@ -634,8 +633,3 @@ def test_all_custom_freq(self, freq):
msg = 'invalid custom frequency string: {freq}'
with tm.assert_raises_regex(ValueError, msg.format(freq=bad_freq)):
bdate_range(START, END, freq=bad_freq)

def test_deprecation_cdaterange(self):
# GH17596
with tm.assert_produces_warning(FutureWarning):
cdate_range(START, END)
0