Skip to content

Revert "Revert "MAINT: Remove Long and WidePanel (#15748)" (#15802)" #18341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this last section compare?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure? I just saw this variable being assigned and not being used afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, if you can remove that (doesn't look like it does anything) would be great.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. Done.

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