Skip to content

Commit

Permalink
CLN: Remove the Panel4D and PanelND classes (#19059)
Browse files Browse the repository at this point in the history
Deprecated back in v0.19.0

xref gh-13147
  • Loading branch information
gfyoung authored and jreback committed Jan 3, 2018
1 parent 02fb954 commit 61ed3e5
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 1,654 deletions.
10 changes: 0 additions & 10 deletions doc/source/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,6 @@ Levels
`Flatten Hierarchical columns
<http://stackoverflow.com/questions/14507794/python-pandas-how-to-flatten-a-hierarchical-index-in-columns>`__

panelnd
*******

The :ref:`panelnd<dsintro.panelnd>` docs.

`Construct a 5D panelnd
<http://stackoverflow.com/questions/18748598/why-my-panelnd-factory-throwing-a-keyerror>`__

.. _cookbook.missing_data:

Missing Data
------------

Expand Down
18 changes: 0 additions & 18 deletions doc/source/dsintro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -982,21 +982,3 @@ Alternatively, one can convert to an xarray ``DataArray``.
p.to_xarray()
You can see the full-documentation for the `xarray package <http://xarray.pydata.org/en/stable/>`__.

.. _dsintro.panelnd:
.. _dsintro.panel4d:

Panel4D and PanelND (Deprecated)
--------------------------------

.. warning::

In 0.19.0 ``Panel4D`` and ``PanelND`` are deprecated and will be removed in
a future version. The recommended way to represent these types of
n-dimensional data are with the
`xarray package <http://xarray.pydata.org/en/stable/>`__.
Pandas provides a :meth:`~Panel4D.to_xarray` method to automate
this conversion.

See the `docs of a previous version <http://pandas.pydata.org/pandas-docs/version/0.18.1/dsintro.html#panel4d-experimental>`__
for documentation on these objects.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.23.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ Removal of prior version deprecations/changes
- The ``Series``, ``Categorical``, and ``Index`` classes have dropped the ``reshape`` method (:issue:`13012`)
- ``pandas.tseries.frequencies.get_standard_freq`` has been removed in favor of ``pandas.tseries.frequencies.to_offset(freq).rule_code`` (:issue:`13874`)
- The ``freqstr`` keyword has been removed from ``pandas.tseries.frequencies.to_offset`` in favor of ``freq`` (:issue:`13874`)
- The ``Panel4D`` and ``PanelND`` classes have been removed (:issue:`13776`)

.. _whatsnew_0230.performance:

Expand Down
1 change: 0 additions & 1 deletion pandas/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from pandas.core.series import Series
from pandas.core.frame import DataFrame
from pandas.core.panel import Panel, WidePanel
from pandas.core.panel4d import Panel4D

# TODO: Remove import when statsmodels updates #18264
from pandas.core.reshape.reshape import get_dummies
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/dtypes/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _check(cls, inst):

ABCSeries = create_pandas_abc_type("ABCSeries", "_typ", ("series", ))
ABCDataFrame = create_pandas_abc_type("ABCDataFrame", "_typ", ("dataframe", ))
ABCPanel = create_pandas_abc_type("ABCPanel", "_typ", ("panel", "panel4d"))
ABCPanel = create_pandas_abc_type("ABCPanel", "_typ", ("panel",))
ABCSparseSeries = create_pandas_abc_type("ABCSparseSeries", "_subtyp",
('sparse_series',
'sparse_time_series'))
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7146,7 +7146,7 @@ def describe(self, percentiles=None, include=None, exclude=None):
DataFrame.select_dtypes
"""
if self.ndim >= 3:
msg = "describe is not implemented on Panel or PanelND objects."
msg = "describe is not implemented on Panel objects."
raise NotImplementedError(msg)
elif self.ndim == 2 and self.columns.size == 0:
raise ValueError("Cannot describe a DataFrame without columns")
Expand Down
3 changes: 0 additions & 3 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,9 +1224,6 @@ def reindex(self, *args, **kwargs):
kwargs['minor_axis'] = minor
axes = validate_axis_style_args(self, args, kwargs, 'labels',
'reindex')
if self.ndim >= 4:
# Hack for PanelND
axes = {}
kwargs.update(axes)
kwargs.pop('axis', None)
kwargs.pop('labels', None)
Expand Down
99 changes: 0 additions & 99 deletions pandas/core/panel4d.py

This file was deleted.

132 changes: 0 additions & 132 deletions pandas/core/panelnd.py

This file was deleted.

17 changes: 3 additions & 14 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from pandas.core.dtypes.missing import array_equivalent

import numpy as np
from pandas import (Series, DataFrame, Panel, Panel4D, Index,
from pandas import (Series, DataFrame, Panel, Index,
MultiIndex, Int64Index, isna, concat, to_datetime,
SparseSeries, SparseDataFrame, PeriodIndex,
DatetimeIndex, TimedeltaIndex)
Expand Down Expand Up @@ -180,7 +180,6 @@ class DuplicateWarning(Warning):
DataFrame: u('frame'),
SparseDataFrame: u('sparse_frame'),
Panel: u('wide'),
Panel4D: u('ndim'),
}

# storer class map
Expand All @@ -203,7 +202,6 @@ class DuplicateWarning(Warning):
u('appendable_frame'): 'AppendableFrameTable',
u('appendable_multiframe'): 'AppendableMultiFrameTable',
u('appendable_panel'): 'AppendablePanelTable',
u('appendable_ndim'): 'AppendableNDimTable',
u('worm'): 'WORMTable',
u('legacy_frame'): 'LegacyFrameTable',
u('legacy_panel'): 'LegacyPanelTable',
Expand All @@ -212,8 +210,7 @@ class DuplicateWarning(Warning):
# axes map
_AXES_MAP = {
DataFrame: [0],
Panel: [1, 2],
Panel4D: [1, 2, 3],
Panel: [1, 2]
}

# register our configuration options
Expand Down Expand Up @@ -924,7 +921,7 @@ def append(self, key, value, format=None, append=True, columns=None,
Parameters
----------
key : object
value : {Series, DataFrame, Panel, Panel4D}
value : {Series, DataFrame, Panel}
format: 'table' is the default
table(t) : table format
Write as a PyTables Table structure which may perform
Expand Down Expand Up @@ -4346,14 +4343,6 @@ def is_transposed(self):
return self.data_orientation != tuple(range(self.ndim))


class AppendableNDimTable(AppendablePanelTable):

""" suppor the new appendable table formats """
table_type = u('appendable_ndim')
ndim = 4
obj_type = Panel4D


def _reindex_axis(obj, axis, labels, other=None):
ax = obj._get_axis(axis)
labels = _ensure_index(labels)
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class TestPDApi(Base):
'TimedeltaIndex', 'Timestamp', 'Interval', 'IntervalIndex']

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

# these should be deprecated in the future
deprecated_classes_in_future = ['Panel']
Expand Down
7 changes: 0 additions & 7 deletions pandas/tests/dtypes/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ def test_isna_isnull(self, isna_f):
expected = p.apply(isna_f)
tm.assert_panel_equal(result, expected)

# panel 4d
with catch_warnings(record=True):
for p in [tm.makePanel4D(), tm.add_nans_panel4d(tm.makePanel4D())]:
result = isna_f(p)
expected = p.apply(isna_f)
tm.assert_panel4d_equal(result, expected)

def test_isna_lists(self):
result = isna([[False]])
exp = np.array([[False]])
Expand Down
Loading

0 comments on commit 61ed3e5

Please sign in to comment.