Skip to content

Commit 4f8bc9d

Browse files
committed
Revert "Revert "MAINT: Remove Long and WidePanel (pandas-dev#15748)" (pandas-dev#15802)" [skip ci]
This reverts commit 22f9d0d.
1 parent fa24af9 commit 4f8bc9d

File tree

7 files changed

+8
-44
lines changed

7 files changed

+8
-44
lines changed

asv_bench/benchmarks/pandas_vb_common.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
from importlib import import_module
33

44
import numpy as np
5-
try:
6-
from pandas import Panel
7-
except ImportError:
8-
from pandas import WidePanel as Panel # noqa
5+
from pandas import Panel
96

107
# Compatibility import for lib
118
for imp in ['pandas._libs.lib', 'pandas.lib']:

doc/source/whatsnew/v0.23.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@ Removal of prior version deprecations/changes
875875
and :class:`DatetimeIndex` have been removed. ``infer_dst=True`` is equivalent to
876876
``ambiguous='infer'``, and ``infer_dst=False`` to ``ambiguous='raise'`` (:issue:`7963`).
877877

878+
- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
878879

879880
.. _whatsnew_0230.performance:
880881

pandas/core/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from pandas.core.series import Series
2323
from pandas.core.frame import DataFrame
24-
from pandas.core.panel import Panel, WidePanel
24+
from pandas.core.panel import Panel
2525

2626
# TODO: Remove import when statsmodels updates #18264
2727
from pandas.core.reshape.reshape import get_dummies

pandas/core/panel.py

-21
Original file line numberDiff line numberDiff line change
@@ -1530,24 +1530,3 @@ def _extract_axis(self, data, axis=0, intersect=False):
15301530
ops.add_special_arithmetic_methods(Panel)
15311531
ops.add_flex_arithmetic_methods(Panel)
15321532
Panel._add_numeric_operations()
1533-
1534-
1535-
# legacy
1536-
class WidePanel(Panel):
1537-
1538-
def __init__(self, *args, **kwargs):
1539-
# deprecation, #10892
1540-
warnings.warn("WidePanel is deprecated. Please use Panel",
1541-
FutureWarning, stacklevel=2)
1542-
1543-
super(WidePanel, self).__init__(*args, **kwargs)
1544-
1545-
1546-
class LongPanel(DataFrame):
1547-
1548-
def __init__(self, *args, **kwargs):
1549-
# deprecation, #10892
1550-
warnings.warn("LongPanel is deprecated. Please use DataFrame",
1551-
FutureWarning, stacklevel=2)
1552-
1553-
super(LongPanel, self).__init__(*args, **kwargs)

pandas/tests/api/test_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class TestPDApi(Base):
5050
'TimedeltaIndex', 'Timestamp', 'Interval', 'IntervalIndex']
5151

5252
# these are already deprecated; awaiting removal
53-
deprecated_classes = ['WidePanel', 'TimeGrouper', 'Expr', 'Term']
53+
deprecated_classes = ['TimeGrouper', 'Expr', 'Term']
5454

5555
# these should be deprecated in the future
5656
deprecated_classes_in_future = ['Panel']

pandas/tests/io/test_pytables.py

-3
Original file line numberDiff line numberDiff line change
@@ -2994,9 +2994,6 @@ def _check(left, right):
29942994
wp = tm.makePanel()
29952995
self._check_roundtrip(wp.to_frame(), _check)
29962996

2997-
def test_longpanel(self):
2998-
pass
2999-
30002997
def test_overwrite_node(self):
30012998

30022999
with ensure_clean_store(self.path) as store:

pandas/tests/test_panel.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,6 @@ def wrapper(x):
183183

184184
class SafeForSparse(object):
185185

186-
@classmethod
187-
def assert_panel_equal(cls, x, y):
188-
assert_panel_equal(x, y)
189-
190186
def test_get_axis(self):
191187
assert (self.panel._get_axis(0) is self.panel.items)
192188
assert (self.panel._get_axis(1) is self.panel.major_axis)
@@ -477,8 +473,6 @@ def test_delitem_and_pop(self):
477473

478474
def test_setitem(self):
479475
with catch_warnings(record=True):
480-
481-
# LongPanel with one item
482476
lp = self.panel.filter(['ItemA', 'ItemB']).to_frame()
483477
with pytest.raises(ValueError):
484478
self.panel['ItemE'] = lp
@@ -905,10 +899,6 @@ def test_set_value(self):
905899
class TestPanel(PanelTests, CheckIndexing, SafeForLongAndSparse,
906900
SafeForSparse):
907901

908-
@classmethod
909-
def assert_panel_equal(cls, x, y):
910-
assert_panel_equal(x, y)
911-
912902
def setup_method(self, method):
913903
self.panel = make_test_panel()
914904
self.panel.major_axis.name = None
@@ -2154,8 +2144,8 @@ def test_multiindex_get(self):
21542144
assert (f1.items == [1, 2]).all()
21552145
assert (f2.items == [1, 2]).all()
21562146

2157-
ind = MultiIndex.from_tuples([('a', 1), ('a', 2), ('b', 1)],
2158-
names=['first', 'second'])
2147+
MultiIndex.from_tuples([('a', 1), ('a', 2), ('b', 1)],
2148+
names=['first', 'second'])
21592149

21602150
def test_multiindex_blocks(self):
21612151
with catch_warnings(record=True):
@@ -2462,9 +2452,9 @@ def test_sort_values(self):
24622452
pytest.raises(NotImplementedError, self.panel.sort_values, 'ItemA')
24632453

24642454

2465-
class TestLongPanel(object):
2455+
class TestPanelFrame(object):
24662456
"""
2467-
LongPanel no longer exists, but...
2457+
Check that conversions to and from Panel to DataFrame work.
24682458
"""
24692459

24702460
def setup_method(self, method):

0 commit comments

Comments
 (0)