From e2042e3b883b0bbd7148ce28ca24f285d70e4002 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Sun, 7 Jan 2018 15:54:41 +0000 Subject: [PATCH] DEPR: Removing previously deprecated datetools module (#6581) --- doc/source/whatsnew/v0.23.0.txt | 1 + pandas/core/api.py | 11 ------- pandas/core/datetools.py | 55 --------------------------------- pandas/tests/api/test_api.py | 15 +-------- 4 files changed, 2 insertions(+), 80 deletions(-) delete mode 100644 pandas/core/datetools.py diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 07e633ded942a..582ff56ffaf9a 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -314,6 +314,7 @@ Removal of prior version deprecations/changes - The ``Panel4D`` and ``PanelND`` classes have been removed (:issue:`13776`) - The ``Panel``class has dropped the ``to_long``and ``toLong`` methods (:issue:`19077`) - The options ``display.line_with`` and ``display.height`` are removed in favor of ``display.width`` and ``display.max_rows`` respectively (:issue:`4391`, :issue:`19107`) +- Removal of the previously deprecated module ``pandas.core.datetools`` (:issue:`14105`, :issue:`14094`) .. _whatsnew_0230.performance: diff --git a/pandas/core/api.py b/pandas/core/api.py index b228a97c99074..4c05df1e9fbb8 100644 --- a/pandas/core/api.py +++ b/pandas/core/api.py @@ -32,17 +32,6 @@ from pandas.core.tools.datetimes import to_datetime from pandas.core.tools.timedeltas import to_timedelta -# see gh-14094. -from pandas.util._depr_module import _DeprecatedModule - -_removals = ['day', 'bday', 'businessDay', 'cday', 'customBusinessDay', - 'customBusinessMonthEnd', 'customBusinessMonthBegin', - 'monthEnd', 'yearEnd', 'yearBegin', 'bmonthEnd', 'bmonthBegin', - 'cbmonthEnd', 'cbmonthBegin', 'bquarterEnd', 'quarterEnd', - 'byearEnd', 'week'] -datetools = _DeprecatedModule(deprmod='pandas.core.datetools', - removals=_removals) - from pandas.core.config import (get_option, set_option, reset_option, describe_option, option_context, options) diff --git a/pandas/core/datetools.py b/pandas/core/datetools.py deleted file mode 100644 index 83167a45369c4..0000000000000 --- a/pandas/core/datetools.py +++ /dev/null @@ -1,55 +0,0 @@ -"""A collection of random tools for dealing with dates in Python. - -.. deprecated:: 0.19.0 - Use pandas.tseries module instead. -""" - -# flake8: noqa - -import warnings - -from pandas.core.tools.datetimes import * -from pandas.tseries.offsets import * -from pandas.tseries.frequencies import * - -warnings.warn("The pandas.core.datetools module is deprecated and will be " - "removed in a future version. Please use the pandas.tseries " - "module instead.", FutureWarning, stacklevel=2) - -day = DateOffset() -bday = BDay() -businessDay = bday -try: - cday = CDay() - customBusinessDay = CustomBusinessDay() - customBusinessMonthEnd = CBMonthEnd() - customBusinessMonthBegin = CBMonthBegin() -except NotImplementedError: - cday = None - customBusinessDay = None - customBusinessMonthEnd = None - customBusinessMonthBegin = None -monthEnd = MonthEnd() -yearEnd = YearEnd() -yearBegin = YearBegin() -bmonthEnd = BMonthEnd() -bmonthBegin = BMonthBegin() -cbmonthEnd = customBusinessMonthEnd -cbmonthBegin = customBusinessMonthBegin -bquarterEnd = BQuarterEnd() -quarterEnd = QuarterEnd() -byearEnd = BYearEnd() -week = Week() - -# Functions/offsets to roll dates forward -thisMonthEnd = MonthEnd(0) -thisBMonthEnd = BMonthEnd(0) -thisYearEnd = YearEnd(0) -thisYearBegin = YearBegin(0) -thisBQuarterEnd = BQuarterEnd(0) -thisQuarterEnd = QuarterEnd(0) - -# Functions to check where a date lies -isBusinessDay = BDay().onOffset -isMonthEnd = MonthEnd().onOffset -isBMonthEnd = BMonthEnd().onOffset diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 8962eb90be828..6bb425b8611bf 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -35,7 +35,7 @@ class TestPDApi(Base): 'util', 'options', 'io'] # these are already deprecated; awaiting removal - deprecated_modules = ['stats', 'datetools', 'parser', + deprecated_modules = ['stats', 'parser', 'json', 'lib', 'tslib'] # misc @@ -140,19 +140,6 @@ def test_testing(self): self.check(testing, self.funcs) -class TestDatetoolsDeprecation(object): - - def test_deprecation_access_func(self): - with tm.assert_produces_warning(FutureWarning, - check_stacklevel=False): - pd.datetools.to_datetime('2016-01-01') - - def test_deprecation_access_obj(self): - with tm.assert_produces_warning(FutureWarning, - check_stacklevel=False): - pd.datetools.monthEnd - - class TestTopLevelDeprecations(object): # top-level API deprecations