From edafc75837f2cbdd882a58e0f6df6d81a363957c 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.22.0.txt | 1 + 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 | 16 ++++------------ 7 files changed, 7 insertions(+), 43 deletions(-) diff --git a/asv_bench/benchmarks/pandas_vb_common.py b/asv_bench/benchmarks/pandas_vb_common.py index b1a58e49fe86c4..03d3b56b737fbe 100644 --- a/asv_bench/benchmarks/pandas_vb_common.py +++ b/asv_bench/benchmarks/pandas_vb_common.py @@ -23,11 +23,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/doc/source/whatsnew/v0.22.0.txt b/doc/source/whatsnew/v0.22.0.txt index c27a684984ba8c..d7011b7918e378 100644 --- a/doc/source/whatsnew/v0.22.0.txt +++ b/doc/source/whatsnew/v0.22.0.txt @@ -76,6 +76,7 @@ Removal of prior version deprecations/changes - Warnings against the obsolete usage ``Categorical(codes, categories)``, which were emitted for instance when the first two arguments to ``Categorical()`` had different dtypes, and recommended the use of ``Categorical.from_codes``, have now been removed (:issue:`8074`) - The ``levels`` and ``labels`` attributes of a ``MultiIndex`` can no longer be set directly (:issue:`4039`). +- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`) - .. _whatsnew_0220.performance: diff --git a/pandas/core/api.py b/pandas/core/api.py index 1f46aaa40e9eb9..a3d86ed1e9e3c8 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 from pandas.core.panel4d import Panel4D from pandas.core.reshape.reshape import ( pivot_simple as pivot, get_dummies) diff --git a/pandas/core/panel.py b/pandas/core/panel.py index 0a5e705071b5e9..7a42e5d2c9aab3 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -1617,24 +1617,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 fad455d6391c33..2b72bf5460c62f 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -51,7 +51,7 @@ class TestPDApi(Base): 'TimedeltaIndex', 'Timestamp', 'Interval', 'IntervalIndex'] # these are already deprecated; awaiting removal - deprecated_classes = ['WidePanel', 'Panel4D', 'TimeGrouper', + deprecated_classes = ['Panel4D', 'TimeGrouper', 'SparseList', 'Expr', 'Term'] # these should be deprecated in the future diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index ca20d089ee5f76..664858814ccac5 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -3145,9 +3145,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 0e783d67517ac0..199c1057bd4d6a 100644 --- a/pandas/tests/test_panel.py +++ b/pandas/tests/test_panel.py @@ -184,10 +184,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) @@ -906,10 +902,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 @@ -2155,8 +2147,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): @@ -2461,9 +2453,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):