From 411b94d6fb6d59f6e68b9e4e78f77947c2a5276f Mon Sep 17 00:00:00 2001 From: gfyoung Date: Mon, 20 Mar 2017 12:08:16 -0400 Subject: [PATCH] MAINT: Remove Long and WidePanel Deprecated since 0.17.0. xref gh-10892 --- asv_bench/benchmarks/pandas_vb_common.py | 5 ----- bench/bench_join_panel.py | 4 ++-- doc/source/whatsnew/v0.20.0.txt | 1 + pandas/core/api.py | 2 +- pandas/core/panel.py | 21 --------------------- pandas/tests/api/test_api.py | 3 +-- pandas/tests/io/test_pytables.py | 3 --- pandas/tests/test_panel.py | 7 ------- vb_suite/pandas_vb_common.py | 5 ----- 9 files changed, 5 insertions(+), 46 deletions(-) diff --git a/asv_bench/benchmarks/pandas_vb_common.py b/asv_bench/benchmarks/pandas_vb_common.py index 56ccc94c414fb..a7e530e7f5ef1 100644 --- a/asv_bench/benchmarks/pandas_vb_common.py +++ b/asv_bench/benchmarks/pandas_vb_common.py @@ -25,11 +25,6 @@ except: pass -try: - Panel = Panel -except Exception: - Panel = WidePanel - # didn't add to namespace until later try: from pandas.core.index import MultiIndex diff --git a/bench/bench_join_panel.py b/bench/bench_join_panel.py index f3c3f8ba15f70..113b317dd8ff8 100644 --- a/bench/bench_join_panel.py +++ b/bench/bench_join_panel.py @@ -45,8 +45,8 @@ def reindex_on_axis(panels, axis, axis_reindex): return p -# does the job but inefficient (better to handle like you read a table in -# pytables...e.g create a LongPanel then convert to Wide) +# Does the job but inefficient. It is better to handle +# this like you read a table in pytables. def create_panels_join(cls, panels): """ given an array of panels's, create a single panel """ panels = [a for a in panels if a is not None] diff --git a/doc/source/whatsnew/v0.20.0.txt b/doc/source/whatsnew/v0.20.0.txt index af0d0d7b04475..72e4bdea622be 100644 --- a/doc/source/whatsnew/v0.20.0.txt +++ b/doc/source/whatsnew/v0.20.0.txt @@ -772,6 +772,7 @@ Removal of prior version deprecations/changes - The ``Categorical`` constructor has dropped the ``name`` parameter (:issue:`10632`) - The ``take_last`` parameter has been dropped from ``duplicated()``, ``drop_duplicates()``, ``nlargest()``, and ``nsmallest()`` methods (:issue:`10236`, :issue:`10792`, :issue:`10920`) - ``Series``, ``Index``, and ``DataFrame`` have dropped the ``sort`` and ``order`` methods (:issue:`10726`) +- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`) .. _whatsnew_0200.performance: diff --git a/pandas/core/api.py b/pandas/core/api.py index 65253dedb8b53..5018de39ca907 100644 --- a/pandas/core/api.py +++ b/pandas/core/api.py @@ -15,7 +15,7 @@ from pandas.core.series import Series from pandas.core.frame import DataFrame -from pandas.core.panel import Panel, WidePanel +from pandas.core.panel import Panel from pandas.core.panel4d import Panel4D from pandas.core.reshape import (pivot_simple as pivot, get_dummies, lreshape, wide_to_long) diff --git a/pandas/core/panel.py b/pandas/core/panel.py index 4a6c6cf291316..4927d9f8f1f38 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -1556,24 +1556,3 @@ def f(self, other, axis=0): ops.add_special_arithmetic_methods(Panel, **ops.panel_special_funcs) Panel._add_aggregate_operations() Panel._add_numeric_operations() - - -# legacy -class WidePanel(Panel): - - def __init__(self, *args, **kwargs): - # deprecation, #10892 - warnings.warn("WidePanel is deprecated. Please use Panel", - FutureWarning, stacklevel=2) - - super(WidePanel, self).__init__(*args, **kwargs) - - -class LongPanel(DataFrame): - - def __init__(self, *args, **kwargs): - # deprecation, #10892 - warnings.warn("LongPanel is deprecated. Please use DataFrame", - FutureWarning, stacklevel=2) - - super(LongPanel, self).__init__(*args, **kwargs) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 73222c246fc70..2c7dcf2501f32 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -54,8 +54,7 @@ class TestPDApi(Base, tm.TestCase): 'TimedeltaIndex', 'Timestamp'] # these are already deprecated; awaiting removal - deprecated_classes = ['WidePanel', 'Panel4D', - 'SparseList', 'Expr', 'Term'] + deprecated_classes = ['Panel4D', 'SparseList', 'Expr', 'Term'] # these should be deprecated in the future deprecated_classes_in_future = ['Panel'] diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 40866b8702fe2..324160d5b1ae6 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -3017,9 +3017,6 @@ def _check(left, right): # empty # self._check_roundtrip(wp.to_frame()[:0], _check) - def test_longpanel(self): - pass - def test_overwrite_node(self): with ensure_clean_store(self.path) as store: diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py index ab0322abbcf06..370536b3b83d2 100644 --- a/pandas/tests/test_panel.py +++ b/pandas/tests/test_panel.py @@ -178,10 +178,6 @@ def wrapper(x): class SafeForSparse(object): - @classmethod - def assert_panel_equal(cls, x, y): - assert_panel_equal(x, y) - def test_get_axis(self): assert (self.panel._get_axis(0) is self.panel.items) assert (self.panel._get_axis(1) is self.panel.major_axis) @@ -2276,9 +2272,6 @@ class TestLongPanel(tm.TestCase): """ def setUp(self): - import warnings - warnings.filterwarnings(action='ignore', category=FutureWarning) - panel = tm.makePanel() tm.add_nans(panel) diff --git a/vb_suite/pandas_vb_common.py b/vb_suite/pandas_vb_common.py index bd2e8a1c1d504..41e43d6ab10e5 100644 --- a/vb_suite/pandas_vb_common.py +++ b/vb_suite/pandas_vb_common.py @@ -18,11 +18,6 @@ except: import pandas._libs.lib as lib -try: - Panel = WidePanel -except Exception: - pass - # didn't add to namespace until later try: from pandas.core.index import MultiIndex