Skip to content

Commit

Permalink
Revert "Revert "MAINT: Remove Long and WidePanel (#15748)" (#15802)" (#…
Browse files Browse the repository at this point in the history
…18341)

This reverts commit 22f9d0d.
  • Loading branch information
gfyoung authored and jorisvandenbossche committed May 16, 2018
1 parent 27581e9 commit 501f041
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 44 deletions.
5 changes: 1 addition & 4 deletions asv_bench/benchmarks/pandas_vb_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
from importlib import import_module

import numpy as np
try:
from pandas import Panel
except ImportError:
from pandas import WidePanel as Panel # noqa
from pandas import Panel

# Compatibility import for lib
for imp in ['pandas._libs.lib', 'pandas.lib']:
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Deprecations
Removal of prior version deprecations/changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
-
-
-
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# TODO: Remove import when statsmodels updates #18264
from pandas.core.reshape.reshape import get_dummies
Expand Down
21 changes: 0 additions & 21 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,24 +1533,3 @@ def _extract_axis(self, data, axis=0, intersect=False):
ops.add_special_arithmetic_methods(Panel)
ops.add_flex_arithmetic_methods(Panel)
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)
2 changes: 1 addition & 1 deletion pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TestPDApi(Base):
'TimedeltaIndex', 'Timestamp', 'Interval', 'IntervalIndex']

# these are already deprecated; awaiting removal
deprecated_classes = ['WidePanel', 'TimeGrouper', 'Expr', 'Term']
deprecated_classes = ['TimeGrouper', 'Expr', 'Term']

# these should be deprecated in the future
deprecated_classes_in_future = ['Panel']
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/io/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3006,9 +3006,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:
Expand Down
18 changes: 4 additions & 14 deletions pandas/tests/test_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,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)
Expand Down Expand Up @@ -477,8 +473,6 @@ def test_delitem_and_pop(self):

def test_setitem(self):
with catch_warnings(record=True):

# LongPanel with one item
lp = self.panel.filter(['ItemA', 'ItemB']).to_frame()
with pytest.raises(ValueError):
self.panel['ItemE'] = lp
Expand Down Expand Up @@ -905,10 +899,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
Expand Down Expand Up @@ -2154,8 +2144,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):
Expand Down Expand Up @@ -2462,9 +2452,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):
Expand Down

0 comments on commit 501f041

Please sign in to comment.