Skip to content

Commit 501f041

Browse files
gfyoungjorisvandenbossche
authored andcommittedMay 16, 2018
Revert "Revert "MAINT: Remove Long and WidePanel (#15748)" (#15802)" (#18341)
This reverts commit 22f9d0d.
1 parent 27581e9 commit 501f041

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.24.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Deprecations
4545
Removal of prior version deprecations/changes
4646
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4747

48+
- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
4849
-
4950
-
5051
-

‎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
@@ -1533,24 +1533,3 @@ def _extract_axis(self, data, axis=0, intersect=False):
15331533
ops.add_special_arithmetic_methods(Panel)
15341534
ops.add_flex_arithmetic_methods(Panel)
15351535
Panel._add_numeric_operations()
1536-
1537-
1538-
# legacy
1539-
class WidePanel(Panel):
1540-
1541-
def __init__(self, *args, **kwargs):
1542-
# deprecation, #10892
1543-
warnings.warn("WidePanel is deprecated. Please use Panel",
1544-
FutureWarning, stacklevel=2)
1545-
1546-
super(WidePanel, self).__init__(*args, **kwargs)
1547-
1548-
1549-
class LongPanel(DataFrame):
1550-
1551-
def __init__(self, *args, **kwargs):
1552-
# deprecation, #10892
1553-
warnings.warn("LongPanel is deprecated. Please use DataFrame",
1554-
FutureWarning, stacklevel=2)
1555-
1556-
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
@@ -3006,9 +3006,6 @@ def _check(left, right):
30063006
wp = tm.makePanel()
30073007
self._check_roundtrip(wp.to_frame(), _check)
30083008

3009-
def test_longpanel(self):
3010-
pass
3011-
30123009
def test_overwrite_node(self):
30133010

30143011
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)
Please sign in to comment.