Skip to content

Commit

Permalink
Revert "Revert "MAINT: Remove Long and WidePanel (pandas-dev#15748)" (p…
Browse files Browse the repository at this point in the history
…andas-dev#15802)" [skip ci]

This reverts commit 22f9d0d.
gfyoung committed May 3, 2018
1 parent ce4ab82 commit 5eb02dd
Showing 7 changed files with 9 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
@@ -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']:
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.23.0.txt
Original file line number Diff line number Diff line change
@@ -1039,6 +1039,8 @@ Removal of prior version deprecations/changes
so operations would continue to work. This is now fully removed, so a ``Resampler`` will no longer forward compat operations (:issue:`20554`)
- Remove long deprecated ``axis=None`` parameter from ``.replace()`` (:issue:`20271`)

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

.. _whatsnew_0230.performance:

Performance Improvements
2 changes: 1 addition & 1 deletion pandas/core/api.py
Original file line number Diff line number Diff line change
@@ -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
21 changes: 0 additions & 21 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
@@ -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
@@ -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']
3 changes: 0 additions & 3 deletions pandas/tests/io/test_pytables.py
Original file line number Diff line number Diff line change
@@ -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:
18 changes: 4 additions & 14 deletions pandas/tests/test_panel.py
Original file line number Diff line number Diff line change
@@ -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)
@@ -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
@@ -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
@@ -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):
@@ -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):

0 comments on commit 5eb02dd

Please sign in to comment.