From 90e94e3cfdd05f90569cbb67fdadbae7cbce6bab Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sun, 28 Oct 2018 06:42:55 -0700 Subject: [PATCH] CLN: Remove pandas.tools module (#23376) xref gh-15358. xref gh-16005. --- doc/source/whatsnew/v0.24.0.txt | 1 + pandas/__init__.py | 8 ---- pandas/plotting/_style.py | 10 ----- pandas/tests/api/test_api.py | 4 +- pandas/tests/plotting/test_deprecated.py | 57 ------------------------ pandas/tools/__init__.py | 0 pandas/tools/merge.py | 17 ------- pandas/tools/plotting.py | 20 --------- 8 files changed, 3 insertions(+), 114 deletions(-) delete mode 100644 pandas/tests/plotting/test_deprecated.py delete mode 100644 pandas/tools/__init__.py delete mode 100644 pandas/tools/merge.py delete mode 100644 pandas/tools/plotting.py diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 3e568fde0a616..89acd1a14a412 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -952,6 +952,7 @@ Removal of prior version deprecations/changes - :meth:`TimedeltaIndex.searchsorted`, :meth:`DatetimeIndex.searchsorted`, and :meth:`PeriodIndex.searchsorted` have renamed the ``key`` argument to ``value`` (:issue:`14645`) - :meth:`DataFrame.consolidate` and :meth:`Series.consolidate` have been removed (:issue:`15501`) - Removal of the previously deprecated module ``pandas.json`` (:issue:`19944`) +- The module ``pandas.tools`` has been removed (:issue:`15358`, :issue:`16005`) - :meth:`SparseArray.get_values` and :meth:`SparseArray.to_dense` have dropped the ``fill`` parameter (:issue:`14686`) - :meth:`DataFrame.sortlevel` and :meth:`Series.sortlevel` have been removed (:issue:`15099`) - :meth:`SparseSeries.to_dense` has dropped the ``sparse_only`` parameter (:issue:`14686`) diff --git a/pandas/__init__.py b/pandas/__init__.py index af14319419c42..e86ed86fda74f 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -45,14 +45,6 @@ from pandas.core.computation.api import * from pandas.core.reshape.api import * -# deprecate tools.plotting, plot_params and scatter_matrix on the top namespace -import pandas.tools.plotting -plot_params = pandas.plotting._style._Options(deprecated=True) -# do not import deprecate to top namespace -scatter_matrix = pandas.util._decorators.deprecate( - 'pandas.scatter_matrix', pandas.plotting.scatter_matrix, '0.20.0', - 'pandas.plotting.scatter_matrix') - from pandas.util._print_versions import show_versions from pandas.io.api import * from pandas.util._tester import test diff --git a/pandas/plotting/_style.py b/pandas/plotting/_style.py index 9bc12d22e1685..da26c0f8fa7e2 100644 --- a/pandas/plotting/_style.py +++ b/pandas/plotting/_style.py @@ -110,14 +110,7 @@ def __init__(self, deprecated=False): # self['xaxis.compat'] = False super(_Options, self).__setitem__('xaxis.compat', False) - def _warn_if_deprecated(self): - if self._deprecated: - warnings.warn("'pandas.plot_params' is deprecated. Use " - "'pandas.plotting.plot_params' instead", - FutureWarning, stacklevel=3) - def __getitem__(self, key): - self._warn_if_deprecated() key = self._get_canonical_key(key) if key not in self: raise ValueError( @@ -125,7 +118,6 @@ def __getitem__(self, key): return super(_Options, self).__getitem__(key) def __setitem__(self, key, value): - self._warn_if_deprecated() key = self._get_canonical_key(key) return super(_Options, self).__setitem__(key, value) @@ -148,7 +140,6 @@ def reset(self): ------- None """ - self._warn_if_deprecated() self.__init__() def _get_canonical_key(self, key): @@ -160,7 +151,6 @@ def use(self, key, value): Temporarily set a parameter value using the with statement. Aliasing allowed. """ - self._warn_if_deprecated() old_value = self[key] try: self[key] = value diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index fef87c9e6c4c2..da894a0881400 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -29,7 +29,7 @@ class TestPDApi(Base): # top-level sub-packages lib = ['api', 'compat', 'core', 'errors', 'pandas', - 'plotting', 'test', 'testing', 'tools', 'tseries', + 'plotting', 'test', 'testing', 'tseries', 'util', 'options', 'io'] # these are already deprecated; awaiting removal @@ -88,7 +88,7 @@ class TestPDApi(Base): deprecated_funcs_in_future = [] # these are already deprecated; awaiting removal - deprecated_funcs = ['plot_params', 'scatter_matrix'] + deprecated_funcs = [] def test_api(self): diff --git a/pandas/tests/plotting/test_deprecated.py b/pandas/tests/plotting/test_deprecated.py deleted file mode 100644 index a45b17ec98261..0000000000000 --- a/pandas/tests/plotting/test_deprecated.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding: utf-8 - -import string - -import pandas as pd -import pandas.util.testing as tm -import pandas.util._test_decorators as td -import pytest - -from numpy.random import randn - -import pandas.tools.plotting as plotting - -from pandas.tests.plotting.common import TestPlotBase - - -""" -Test cases for plot functions imported from deprecated -pandas.tools.plotting -""" - - -@td.skip_if_no_mpl -class TestDeprecatedNameSpace(TestPlotBase): - - @pytest.mark.slow - @td.skip_if_no_scipy - def test_scatter_plot_legacy(self): - df = pd.DataFrame(randn(100, 2)) - - with tm.assert_produces_warning(FutureWarning): - plotting.scatter_matrix(df) - - with tm.assert_produces_warning(FutureWarning): - pd.scatter_matrix(df) - - @pytest.mark.slow - def test_boxplot_deprecated(self): - df = pd.DataFrame(randn(6, 4), - index=list(string.ascii_letters[:6]), - columns=['one', 'two', 'three', 'four']) - df['indic'] = ['foo', 'bar'] * 3 - - with tm.assert_produces_warning(FutureWarning): - plotting.boxplot(df, column=['one', 'two'], - by='indic') - - @pytest.mark.slow - def test_radviz_deprecated(self, iris): - with tm.assert_produces_warning(FutureWarning): - plotting.radviz(frame=iris, class_column='Name') - - @pytest.mark.slow - def test_plot_params(self): - - with tm.assert_produces_warning(FutureWarning): - pd.plot_params['xaxis.compat'] = True diff --git a/pandas/tools/__init__.py b/pandas/tools/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pandas/tools/merge.py b/pandas/tools/merge.py deleted file mode 100644 index cd58aa2c7f923..0000000000000 --- a/pandas/tools/merge.py +++ /dev/null @@ -1,17 +0,0 @@ -import warnings - - -# back-compat of pseudo-public API -def concat_wrap(): - - def wrapper(*args, **kwargs): - warnings.warn("pandas.tools.merge.concat is deprecated. " - "import from the public API: " - "pandas.concat instead", - FutureWarning, stacklevel=3) - import pandas as pd - return pd.concat(*args, **kwargs) - return wrapper - - -concat = concat_wrap() diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py deleted file mode 100644 index a68da67a219e2..0000000000000 --- a/pandas/tools/plotting.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import warnings - -import pandas.plotting as _plotting - -# back-compat of public API -# deprecate these functions -m = sys.modules['pandas.tools.plotting'] -for t in [t for t in dir(_plotting) if not t.startswith('_')]: - - def outer(t=t): - - def wrapper(*args, **kwargs): - warnings.warn("'pandas.tools.plotting.{t}' is deprecated, " - "import 'pandas.plotting.{t}' instead.".format(t=t), - FutureWarning, stacklevel=2) - return getattr(_plotting, t)(*args, **kwargs) - return wrapper - - setattr(m, t, outer(t))