Skip to content

Commit 4eba070

Browse files
committed
CLN: Remove the Panel4D and PanelND classes
Deprecated back in v0.19.0 xref gh-13147
1 parent 6552718 commit 4eba070

21 files changed

+24
-1648
lines changed

doc/source/cookbook.rst

-10
Original file line numberDiff line numberDiff line change
@@ -411,16 +411,6 @@ Levels
411411
`Flatten Hierarchical columns
412412
<http://stackoverflow.com/questions/14507794/python-pandas-how-to-flatten-a-hierarchical-index-in-columns>`__
413413

414-
panelnd
415-
*******
416-
417-
The :ref:`panelnd<dsintro.panelnd>` docs.
418-
419-
`Construct a 5D panelnd
420-
<http://stackoverflow.com/questions/18748598/why-my-panelnd-factory-throwing-a-keyerror>`__
421-
422-
.. _cookbook.missing_data:
423-
424414
Missing Data
425415
------------
426416

doc/source/dsintro.rst

-18
Original file line numberDiff line numberDiff line change
@@ -982,21 +982,3 @@ Alternatively, one can convert to an xarray ``DataArray``.
982982
p.to_xarray()
983983
984984
You can see the full-documentation for the `xarray package <http://xarray.pydata.org/en/stable/>`__.
985-
986-
.. _dsintro.panelnd:
987-
.. _dsintro.panel4d:
988-
989-
Panel4D and PanelND (Deprecated)
990-
--------------------------------
991-
992-
.. warning::
993-
994-
In 0.19.0 ``Panel4D`` and ``PanelND`` are deprecated and will be removed in
995-
a future version. The recommended way to represent these types of
996-
n-dimensional data are with the
997-
`xarray package <http://xarray.pydata.org/en/stable/>`__.
998-
Pandas provides a :meth:`~Panel4D.to_xarray` method to automate
999-
this conversion.
1000-
1001-
See the `docs of a previous version <http://pandas.pydata.org/pandas-docs/version/0.18.1/dsintro.html#panel4d-experimental>`__
1002-
for documentation on these objects.

doc/source/whatsnew/v0.23.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ Removal of prior version deprecations/changes
249249
- The ``Series``, ``Categorical``, and ``Index`` classes have dropped the ``reshape`` method (:issue:`13012`)
250250
- ``pandas.tseries.frequencies.get_standard_freq`` has been removed in favor of ``pandas.tseries.frequencies.to_offset(freq).rule_code`` (:issue:`13874`)
251251
- The ``freqstr`` keyword has been removed from ``pandas.tseries.frequencies.to_offset`` in favor of ``freq`` (:issue:`13874`)
252+
- The ``Panel4D`` and ``PanelND`` classes have been removed (:issue:`13776`)
252253

253254
.. _whatsnew_0230.performance:
254255

pandas/core/api.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from pandas.core.series import Series
2323
from pandas.core.frame import DataFrame
2424
from pandas.core.panel import Panel, WidePanel
25-
from pandas.core.panel4d import Panel4D
2625

2726
# TODO: Remove import when statsmodels updates #18264
2827
from pandas.core.reshape.reshape import get_dummies

pandas/core/dtypes/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _check(cls, inst):
4343

4444
ABCSeries = create_pandas_abc_type("ABCSeries", "_typ", ("series", ))
4545
ABCDataFrame = create_pandas_abc_type("ABCDataFrame", "_typ", ("dataframe", ))
46-
ABCPanel = create_pandas_abc_type("ABCPanel", "_typ", ("panel", "panel4d"))
46+
ABCPanel = create_pandas_abc_type("ABCPanel", "_typ", ("panel",))
4747
ABCSparseSeries = create_pandas_abc_type("ABCSparseSeries", "_subtyp",
4848
('sparse_series',
4949
'sparse_time_series'))

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7146,7 +7146,7 @@ def describe(self, percentiles=None, include=None, exclude=None):
71467146
DataFrame.select_dtypes
71477147
"""
71487148
if self.ndim >= 3:
7149-
msg = "describe is not implemented on Panel or PanelND objects."
7149+
msg = "describe is not implemented on Panel objects."
71507150
raise NotImplementedError(msg)
71517151
elif self.ndim == 2 and self.columns.size == 0:
71527152
raise ValueError("Cannot describe a DataFrame without columns")

pandas/core/panel.py

-3
Original file line numberDiff line numberDiff line change
@@ -1224,9 +1224,6 @@ def reindex(self, *args, **kwargs):
12241224
kwargs['minor_axis'] = minor
12251225
axes = validate_axis_style_args(self, args, kwargs, 'labels',
12261226
'reindex')
1227-
if self.ndim >= 4:
1228-
# Hack for PanelND
1229-
axes = {}
12301227
kwargs.update(axes)
12311228
kwargs.pop('axis', None)
12321229
kwargs.pop('labels', None)

pandas/core/panel4d.py

-99
This file was deleted.

pandas/core/panelnd.py

-132
This file was deleted.

pandas/io/pytables.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from pandas.core.dtypes.missing import array_equivalent
2525

2626
import numpy as np
27-
from pandas import (Series, DataFrame, Panel, Panel4D, Index,
27+
from pandas import (Series, DataFrame, Panel, Index,
2828
MultiIndex, Int64Index, isna, concat, to_datetime,
2929
SparseSeries, SparseDataFrame, PeriodIndex,
3030
DatetimeIndex, TimedeltaIndex)
@@ -180,7 +180,6 @@ class DuplicateWarning(Warning):
180180
DataFrame: u('frame'),
181181
SparseDataFrame: u('sparse_frame'),
182182
Panel: u('wide'),
183-
Panel4D: u('ndim'),
184183
}
185184

186185
# storer class map
@@ -203,7 +202,6 @@ class DuplicateWarning(Warning):
203202
u('appendable_frame'): 'AppendableFrameTable',
204203
u('appendable_multiframe'): 'AppendableMultiFrameTable',
205204
u('appendable_panel'): 'AppendablePanelTable',
206-
u('appendable_ndim'): 'AppendableNDimTable',
207205
u('worm'): 'WORMTable',
208206
u('legacy_frame'): 'LegacyFrameTable',
209207
u('legacy_panel'): 'LegacyPanelTable',
@@ -212,8 +210,7 @@ class DuplicateWarning(Warning):
212210
# axes map
213211
_AXES_MAP = {
214212
DataFrame: [0],
215-
Panel: [1, 2],
216-
Panel4D: [1, 2, 3],
213+
Panel: [1, 2]
217214
}
218215

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

43484345

4349-
class AppendableNDimTable(AppendablePanelTable):
4350-
4351-
""" suppor the new appendable table formats """
4352-
table_type = u('appendable_ndim')
4353-
ndim = 4
4354-
obj_type = Panel4D
4355-
4356-
43574346
def _reindex_axis(obj, axis, labels, other=None):
43584347
ax = obj._get_axis(axis)
43594348
labels = _ensure_index(labels)

pandas/tests/api/test_api.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ class TestPDApi(Base):
5151
'TimedeltaIndex', 'Timestamp', 'Interval', 'IntervalIndex']
5252

5353
# these are already deprecated; awaiting removal
54-
deprecated_classes = ['WidePanel', 'Panel4D', 'TimeGrouper',
55-
'Expr', 'Term']
54+
deprecated_classes = ['WidePanel', 'TimeGrouper', 'Expr', 'Term']
5655

5756
# these should be deprecated in the future
5857
deprecated_classes_in_future = ['Panel']

pandas/tests/dtypes/test_missing.py

-7
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ def test_isna_isnull(self, isna_f):
9999
expected = p.apply(isna_f)
100100
tm.assert_panel_equal(result, expected)
101101

102-
# panel 4d
103-
with catch_warnings(record=True):
104-
for p in [tm.makePanel4D(), tm.add_nans_panel4d(tm.makePanel4D())]:
105-
result = isna_f(p)
106-
expected = p.apply(isna_f)
107-
tm.assert_panel4d_equal(result, expected)
108-
109102
def test_isna_lists(self):
110103
result = isna([[False]])
111104
exp = np.array([[False]])

0 commit comments

Comments
 (0)