diff --git a/asv_bench/benchmarks/pandas_vb_common.py b/asv_bench/benchmarks/pandas_vb_common.py index c0d24afae4219..e255cd94f265b 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 66a71f30a3489..8f5f662ac6f3c 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -1050,6 +1050,8 @@ Removal of prior version deprecations/changes so operations would continue to work. This is now fully removed, so a ``Resampler`` will no longer forward compat operations (:issue:`20554`) - Remove long deprecated ``axis=None`` parameter from ``.replace()`` (:issue:`20271`) +- 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 640baf31268a7..fa58e932ead13 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 16e64192fdb20..fe46b8a66e5ef 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -1533,24 +1533,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 ea6c250420b13..ddee4894456ea 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 5ac91c15047ff..381a059244858 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -3006,9 +3006,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 7973b27601237..12d803a76e7f3 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):