Skip to content

Commit bff47f2

Browse files
gfyoungjreback
authored andcommitted
MAINT: Remove Long and WidePanel (pandas-dev#15748)
Deprecated since 0.17.0. xref pandas-devgh-10892
1 parent 2b45e44 commit bff47f2

File tree

9 files changed

+17
-64
lines changed

9 files changed

+17
-64
lines changed

asv_bench/benchmarks/pandas_vb_common.py

-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
except:
2626
pass
2727

28-
try:
29-
Panel = Panel
30-
except Exception:
31-
Panel = WidePanel
32-
3328
# didn't add to namespace until later
3429
try:
3530
from pandas.core.index import MultiIndex

bench/bench_join_panel.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def reindex_on_axis(panels, axis, axis_reindex):
4545
return p
4646

4747

48-
# does the job but inefficient (better to handle like you read a table in
49-
# pytables...e.g create a LongPanel then convert to Wide)
48+
# Does the job but inefficient. It is better to handle
49+
# this like you read a table in pytables.
5050
def create_panels_join(cls, panels):
5151
""" given an array of panels's, create a single panel """
5252
panels = [a for a in panels if a is not None]

doc/source/whatsnew/v0.20.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ Removal of prior version deprecations/changes
772772
- The ``Categorical`` constructor has dropped the ``name`` parameter (:issue:`10632`)
773773
- The ``take_last`` parameter has been dropped from ``duplicated()``, ``drop_duplicates()``, ``nlargest()``, and ``nsmallest()`` methods (:issue:`10236`, :issue:`10792`, :issue:`10920`)
774774
- ``Series``, ``Index``, and ``DataFrame`` have dropped the ``sort`` and ``order`` methods (:issue:`10726`)
775+
- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
775776

776777
.. _whatsnew_0200.performance:
777778

pandas/core/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from pandas.core.series import Series
1717
from pandas.core.frame import DataFrame
18-
from pandas.core.panel import Panel, WidePanel
18+
from pandas.core.panel import Panel
1919
from pandas.core.panel4d import Panel4D
2020
from pandas.core.reshape import (pivot_simple as pivot, get_dummies,
2121
lreshape, wide_to_long)

pandas/core/panel.py

-23
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# pylint: disable=E1103,W0231,W0212,W0621
55
from __future__ import division
66

7-
import warnings
8-
97
import numpy as np
108

119
from pandas.types.cast import (_infer_dtype_from_scalar,
@@ -1556,24 +1554,3 @@ def f(self, other, axis=0):
15561554
ops.add_special_arithmetic_methods(Panel, **ops.panel_special_funcs)
15571555
Panel._add_aggregate_operations()
15581556
Panel._add_numeric_operations()
1559-
1560-
1561-
# legacy
1562-
class WidePanel(Panel):
1563-
1564-
def __init__(self, *args, **kwargs):
1565-
# deprecation, #10892
1566-
warnings.warn("WidePanel is deprecated. Please use Panel",
1567-
FutureWarning, stacklevel=2)
1568-
1569-
super(WidePanel, self).__init__(*args, **kwargs)
1570-
1571-
1572-
class LongPanel(DataFrame):
1573-
1574-
def __init__(self, *args, **kwargs):
1575-
# deprecation, #10892
1576-
warnings.warn("LongPanel is deprecated. Please use DataFrame",
1577-
FutureWarning, stacklevel=2)
1578-
1579-
super(LongPanel, self).__init__(*args, **kwargs)

pandas/tests/api/test_api.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class TestPDApi(Base, tm.TestCase):
5454
'TimedeltaIndex', 'Timestamp']
5555

5656
# these are already deprecated; awaiting removal
57-
deprecated_classes = ['WidePanel', 'Panel4D',
58-
'SparseList', 'Expr', 'Term']
57+
deprecated_classes = ['Panel4D', 'SparseList', 'Expr', 'Term']
5958

6059
# these should be deprecated in the future
6160
deprecated_classes_in_future = ['Panel']

pandas/tests/io/test_pytables.py

-3
Original file line numberDiff line numberDiff line change
@@ -3017,9 +3017,6 @@ def _check(left, right):
30173017
# empty
30183018
# self._check_roundtrip(wp.to_frame()[:0], _check)
30193019

3020-
def test_longpanel(self):
3021-
pass
3022-
30233020
def test_overwrite_node(self):
30243021

30253022
with ensure_clean_store(self.path) as store:

pandas/tests/test_panel.py

+12-23
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ def wrapper(x):
178178

179179
class SafeForSparse(object):
180180

181-
@classmethod
182-
def assert_panel_equal(cls, x, y):
183-
assert_panel_equal(x, y)
184-
185181
def test_get_axis(self):
186182
assert (self.panel._get_axis(0) is self.panel.items)
187183
assert (self.panel._get_axis(1) is self.panel.major_axis)
@@ -346,10 +342,10 @@ def check_op(op, name):
346342

347343
def test_combinePanel(self):
348344
result = self.panel.add(self.panel)
349-
self.assert_panel_equal(result, self.panel * 2)
345+
assert_panel_equal(result, self.panel * 2)
350346

351347
def test_neg(self):
352-
self.assert_panel_equal(-self.panel, self.panel * -1)
348+
assert_panel_equal(-self.panel, self.panel * -1)
353349

354350
# issue 7692
355351
def test_raise_when_not_implemented(self):
@@ -369,22 +365,22 @@ def test_select(self):
369365
# select items
370366
result = p.select(lambda x: x in ('ItemA', 'ItemC'), axis='items')
371367
expected = p.reindex(items=['ItemA', 'ItemC'])
372-
self.assert_panel_equal(result, expected)
368+
assert_panel_equal(result, expected)
373369

374370
# select major_axis
375371
result = p.select(lambda x: x >= datetime(2000, 1, 15), axis='major')
376372
new_major = p.major_axis[p.major_axis >= datetime(2000, 1, 15)]
377373
expected = p.reindex(major=new_major)
378-
self.assert_panel_equal(result, expected)
374+
assert_panel_equal(result, expected)
379375

380376
# select minor_axis
381377
result = p.select(lambda x: x in ('D', 'A'), axis=2)
382378
expected = p.reindex(minor=['A', 'D'])
383-
self.assert_panel_equal(result, expected)
379+
assert_panel_equal(result, expected)
384380

385381
# corner case, empty thing
386382
result = p.select(lambda x: x in ('foo', ), axis='items')
387-
self.assert_panel_equal(result, p.reindex(items=[]))
383+
assert_panel_equal(result, p.reindex(items=[]))
388384

389385
def test_get_value(self):
390386
for item in self.panel.items:
@@ -399,8 +395,8 @@ def test_abs(self):
399395
result = self.panel.abs()
400396
result2 = abs(self.panel)
401397
expected = np.abs(self.panel)
402-
self.assert_panel_equal(result, expected)
403-
self.assert_panel_equal(result2, expected)
398+
assert_panel_equal(result, expected)
399+
assert_panel_equal(result2, expected)
404400

405401
df = self.panel['ItemA']
406402
result = df.abs()
@@ -867,10 +863,6 @@ def test_set_value(self):
867863
class TestPanel(tm.TestCase, PanelTests, CheckIndexing, SafeForLongAndSparse,
868864
SafeForSparse):
869865

870-
@classmethod
871-
def assert_panel_equal(cls, x, y):
872-
assert_panel_equal(x, y)
873-
874866
def setUp(self):
875867
self.panel = _panel.copy()
876868
self.panel.major_axis.name = None
@@ -1967,7 +1959,7 @@ def test_round(self):
19671959
major_axis=pd.date_range('1/1/2000', periods=5),
19681960
minor_axis=['A', 'B'])
19691961
result = p.round()
1970-
self.assert_panel_equal(expected, result)
1962+
assert_panel_equal(expected, result)
19711963

19721964
def test_numpy_round(self):
19731965
values = [[[-3.2, 2.2], [0, -4.8213], [3.123, 123.12],
@@ -1983,7 +1975,7 @@ def test_numpy_round(self):
19831975
major_axis=pd.date_range('1/1/2000', periods=5),
19841976
minor_axis=['A', 'B'])
19851977
result = np.round(p)
1986-
self.assert_panel_equal(expected, result)
1978+
assert_panel_equal(expected, result)
19871979

19881980
msg = "the 'out' parameter is not supported"
19891981
tm.assertRaisesRegexp(ValueError, msg, np.round, p, out=p)
@@ -2270,15 +2262,12 @@ def test_all_any_unhandled(self):
22702262
self.assertRaises(NotImplementedError, self.panel.any, bool_only=True)
22712263

22722264

2273-
class TestLongPanel(tm.TestCase):
2265+
class TestPanelFrame(tm.TestCase):
22742266
"""
2275-
LongPanel no longer exists, but...
2267+
Check that conversions to and from Panel to DataFrame work.
22762268
"""
22772269

22782270
def setUp(self):
2279-
import warnings
2280-
warnings.filterwarnings(action='ignore', category=FutureWarning)
2281-
22822271
panel = tm.makePanel()
22832272
tm.add_nans(panel)
22842273

vb_suite/pandas_vb_common.py

-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
except:
1919
import pandas._libs.lib as lib
2020

21-
try:
22-
Panel = WidePanel
23-
except Exception:
24-
pass
25-
2621
# didn't add to namespace until later
2722
try:
2823
from pandas.core.index import MultiIndex

0 commit comments

Comments
 (0)