From 6433d65effc9ca987ed75d2c069c1a6d44750d8a Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Thu, 2 Aug 2018 11:45:03 +0100 Subject: [PATCH] DEPR: Removing previously deprecated datetools module (#6581) (#19119) --- doc/source/whatsnew/v0.24.0.txt | 2 +- pandas/core/api.py | 11 ------- pandas/core/datetools.py | 55 --------------------------------- pandas/tests/api/test_api.py | 15 +-------- 4 files changed, 2 insertions(+), 81 deletions(-) delete mode 100644 pandas/core/datetools.py diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index e8222efcb63b4e..f47b037c2c70d4 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -488,7 +488,7 @@ Removal of prior version deprecations/changes - The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`) - Several private functions were removed from the (non-public) module ``pandas.core.common`` (:issue:`22001`) -- +- Removal of the previously deprecated module ``pandas.core.datetools`` (:issue:`14105`, :issue:`14094`) - .. _whatsnew_0240.performance: diff --git a/pandas/core/api.py b/pandas/core/api.py index 92586235df93c2..32df317a602a9c 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 83167a45369c43..00000000000000 --- 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 2aa875d1e095a6..bf9e14b4270158 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 = ['datetools', 'parser', 'json', 'lib', 'tslib'] + deprecated_modules = ['parser', 'json', 'lib', 'tslib'] # misc misc = ['IndexSlice', 'NaT'] @@ -127,19 +127,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