From a07f0a781fd341d6c860895e4d1dd61bb28f02c8 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Thu, 16 Nov 2017 23:54:53 -0800 Subject: [PATCH] Revert "Revert "MAINT: Remove Long and WidePanel (#15748)" (#15802)" [skip ci] This reverts commit 22f9d0dd. --- asv_bench/benchmarks/pandas_vb_common.py | 5 +---- doc/source/whatsnew/v0.23.0.txt | 2 ++ pandas/core/api.py | 2 +- pandas/core/panel.py | 21 --------------------- pandas/tests/api/test_api.py | 2 +- pandas/tests/io/test_pytables.py | 3 --- pandas/tests/test_panel.py | 18 ++++-------------- 7 files changed, 9 insertions(+), 44 deletions(-) diff --git a/asv_bench/benchmarks/pandas_vb_common.py b/asv_bench/benchmarks/pandas_vb_common.py index c0d24afae42199..e255cd94f265bf 100644 --- a/asv_bench/benchmarks/pandas_vb_common.py +++ b/asv_bench/benchmarks/pandas_vb_common.py @@ -2,10 +2,7 @@ from importlib import import_module import numpy as np -try: - from pandas import Panel -except ImportError: - from pandas import WidePanel as Panel # noqa +from pandas import Panel # Compatibility import for lib for imp in ['pandas._libs.lib', 'pandas.lib']: diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 2b73a848100457..60d7ab6d35ac9d 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -928,6 +928,8 @@ Removal of prior version deprecations/changes - When ``.resample()`` was changed from an eager to a lazy operation, like ``.groupby()`` in v0.18.0, we put in place compatibility (with a ``FutureWarning``), so operations would continue to work. This is now fully removed, so a ``Resampler`` will no longer forward compat operations (:issue:`20554`) +- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`) + .. _whatsnew_0230.performance: Performance Improvements diff --git a/pandas/core/api.py b/pandas/core/api.py index 640baf31268a72..fa58e932ead133 100644 --- a/pandas/core/api.py +++ b/pandas/core/api.py @@ -21,7 +21,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 # TODO: Remove import when statsmodels updates #18264 from pandas.core.reshape.reshape import get_dummies diff --git a/pandas/core/panel.py b/pandas/core/panel.py index e08d0a7368ccba..bdd918c71f5513 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -1530,24 +1530,3 @@ def _extract_axis(self, data, axis=0, intersect=False): ops.add_special_arithmetic_methods(Panel) ops.add_flex_arithmetic_methods(Panel) 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 ea6c250420b139..ddee4894456ea7 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -50,7 +50,7 @@ class TestPDApi(Base): 'TimedeltaIndex', 'Timestamp', 'Interval', 'IntervalIndex'] # these are already deprecated; awaiting removal - deprecated_classes = ['WidePanel', 'TimeGrouper', 'Expr', 'Term'] + deprecated_classes = ['TimeGrouper', '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 a6a38e005b9b61..0913c73ce92dbe 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -2994,9 +2994,6 @@ def _check(left, right): wp = tm.makePanel() self._check_roundtrip(wp.to_frame(), _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 7973b27601237d..12d803a76e7f33 100644 --- a/pandas/tests/test_panel.py +++ b/pandas/tests/test_panel.py @@ -183,10 +183,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) @@ -477,8 +473,6 @@ def test_delitem_and_pop(self): def test_setitem(self): with catch_warnings(record=True): - - # LongPanel with one item lp = self.panel.filter(['ItemA', 'ItemB']).to_frame() with pytest.raises(ValueError): self.panel['ItemE'] = lp @@ -905,10 +899,6 @@ def test_set_value(self): class TestPanel(PanelTests, CheckIndexing, SafeForLongAndSparse, SafeForSparse): - @classmethod - def assert_panel_equal(cls, x, y): - assert_panel_equal(x, y) - def setup_method(self, method): self.panel = make_test_panel() self.panel.major_axis.name = None @@ -2154,8 +2144,8 @@ def test_multiindex_get(self): assert (f1.items == [1, 2]).all() assert (f2.items == [1, 2]).all() - ind = MultiIndex.from_tuples([('a', 1), ('a', 2), ('b', 1)], - names=['first', 'second']) + MultiIndex.from_tuples([('a', 1), ('a', 2), ('b', 1)], + names=['first', 'second']) def test_multiindex_blocks(self): with catch_warnings(record=True): @@ -2462,9 +2452,9 @@ def test_sort_values(self): pytest.raises(NotImplementedError, self.panel.sort_values, 'ItemA') -class TestLongPanel(object): +class TestPanelFrame(object): """ - LongPanel no longer exists, but... + Check that conversions to and from Panel to DataFrame work. """ def setup_method(self, method):