Skip to content

Commit 087eee3

Browse files
committed
Revert "Revert "MAINT: Remove Long and WidePanel (pandas-dev#15748)" (pandas-dev#15802)"
This reverts commit 22f9d0d.
1 parent 774030c commit 087eee3

File tree

7 files changed

+10
-46
lines changed

7 files changed

+10
-46
lines changed

asv_bench/benchmarks/pandas_vb_common.py

-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
except:
2424
pass
2525

26-
try:
27-
Panel = Panel
28-
except Exception:
29-
Panel = WidePanel
30-
3126
# didn't add to namespace until later
3227
try:
3328
from pandas.core.index import MultiIndex

doc/source/whatsnew/v0.22.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Removal of prior version deprecations/changes
6565

6666
- 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`)
6767
- The ``levels`` and ``labels`` attributes of a ``MultiIndex`` can no longer be set directly (:issue:`4039`).
68+
- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
6869
-
6970

7071
.. _whatsnew_0220.performance:

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
from pandas.core.panel4d import Panel4D
2626
from pandas.core.reshape.reshape import (
2727
pivot_simple as pivot, get_dummies)

pandas/core/panel.py

-21
Original file line numberDiff line numberDiff line change
@@ -1617,24 +1617,3 @@ def f(self, other, axis=0):
16171617
ops.add_special_arithmetic_methods(Panel, **ops.panel_special_funcs)
16181618
Panel._add_aggregate_operations()
16191619
Panel._add_numeric_operations()
1620-
1621-
1622-
# legacy
1623-
class WidePanel(Panel):
1624-
1625-
def __init__(self, *args, **kwargs):
1626-
# deprecation, #10892
1627-
warnings.warn("WidePanel is deprecated. Please use Panel",
1628-
FutureWarning, stacklevel=2)
1629-
1630-
super(WidePanel, self).__init__(*args, **kwargs)
1631-
1632-
1633-
class LongPanel(DataFrame):
1634-
1635-
def __init__(self, *args, **kwargs):
1636-
# deprecation, #10892
1637-
warnings.warn("LongPanel is deprecated. Please use DataFrame",
1638-
FutureWarning, stacklevel=2)
1639-
1640-
super(LongPanel, self).__init__(*args, **kwargs)

pandas/tests/api/test_api.py

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

5353
# these are already deprecated; awaiting removal
54-
deprecated_classes = ['WidePanel', 'Panel4D', 'TimeGrouper',
54+
deprecated_classes = ['Panel4D', 'TimeGrouper',
5555
'SparseList', 'Expr', 'Term']
5656

5757
# these should be deprecated in the future

pandas/tests/io/test_pytables.py

-3
Original file line numberDiff line numberDiff line change
@@ -3145,9 +3145,6 @@ def _check(left, right):
31453145
wp = tm.makePanel()
31463146
self._check_roundtrip(wp.to_frame(), _check)
31473147

3148-
def test_longpanel(self):
3149-
pass
3150-
31513148
def test_overwrite_node(self):
31523149

31533150
with ensure_clean_store(self.path) as store:

pandas/tests/test_panel.py

+7-15
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ def wrapper(x):
184184

185185
class SafeForSparse(object):
186186

187-
@classmethod
188-
def assert_panel_equal(cls, x, y):
189-
assert_panel_equal(x, y)
190-
191187
def test_get_axis(self):
192188
assert (self.panel._get_axis(0) is self.panel.items)
193189
assert (self.panel._get_axis(1) is self.panel.major_axis)
@@ -358,8 +354,7 @@ def test_combinePanel(self):
358354
assert_panel_equal(result, self.panel * 2)
359355

360356
def test_neg(self):
361-
with catch_warnings(record=True):
362-
assert_panel_equal(-self.panel, self.panel * -1)
357+
assert_panel_equal(-self.panel, self.panel * -1)
363358

364359
# issue 7692
365360
def test_raise_when_not_implemented(self):
@@ -906,10 +901,6 @@ def test_set_value(self):
906901
class TestPanel(PanelTests, CheckIndexing, SafeForLongAndSparse,
907902
SafeForSparse):
908903

909-
@classmethod
910-
def assert_panel_equal(cls, x, y):
911-
assert_panel_equal(x, y)
912-
913904
def setup_method(self, method):
914905
self.panel = make_test_panel()
915906
self.panel.major_axis.name = None
@@ -2155,8 +2146,8 @@ def test_multiindex_get(self):
21552146
assert (f1.items == [1, 2]).all()
21562147
assert (f2.items == [1, 2]).all()
21572148

2158-
ind = MultiIndex.from_tuples([('a', 1), ('a', 2), ('b', 1)],
2159-
names=['first', 'second'])
2149+
MultiIndex.from_tuples([('a', 1), ('a', 2), ('b', 1)],
2150+
names=['first', 'second'])
21602151

21612152
def test_multiindex_blocks(self):
21622153
with catch_warnings(record=True):
@@ -2461,13 +2452,14 @@ def test_sort_values(self):
24612452
pytest.raises(NotImplementedError, self.panel.sort_values, 'ItemA')
24622453

24632454

2464-
class TestLongPanel(object):
2455+
class TestPanelFrame(object):
24652456
"""
2466-
LongPanel no longer exists, but...
2457+
Check that conversions to and from Panel to DataFrame work.
24672458
"""
24682459

2469-
def setup_method(self, method):
2460+
def setUp(self):
24702461
panel = make_test_panel()
2462+
24712463
self.panel = panel.to_frame()
24722464
self.unfiltered_panel = panel.to_frame(filter_observations=False)
24732465

0 commit comments

Comments
 (0)