From fcf774be38d6a70bdb47156a9e9a62dfe8ded6ae Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Sun, 14 Jan 2018 17:22:02 -0500 Subject: [PATCH 1/2] DEPR: change Panel DeprecationWarning -> FutureWarning closes #18324 --- doc/source/whatsnew/v0.23.0.txt | 2 ++ pandas/core/panel.py | 2 +- pandas/tests/generic/test_label_or_level_utils.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 14949267fc37d..410a8c7bbd8b6 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -289,6 +289,8 @@ Deprecations - ``Series.valid`` is deprecated. Use :meth:`Series.dropna` instead (:issue:`18800`). - :func:`read_excel` has deprecated the ``skip_footer`` parameter. Use ``skipfooter`` instead (:issue:`18836`) - The ``is_copy`` attribute is deprecated and will be removed in a future version (:issue:`18801`). +- ``Panel`` is now a ``FutureWarning``, previsouly a ``DeprecationWarning`` and will be removed in a future version (:issue:`18324`) + .. _whatsnew_0230.prior_deprecations: diff --git a/pandas/core/panel.py b/pandas/core/panel.py index 26e7c192ad0af..1df69576e6ff2 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -151,7 +151,7 @@ def __init__(self, data=None, items=None, major_axis=None, minor_axis=None, "http://xarray.pydata.org/en/stable/.\n" "Pandas provides a `.to_xarray()` method to help " "automate this conversion.\n", - DeprecationWarning, stacklevel=3) + FutureWarning, stacklevel=3) self._init_data(data=data, items=items, major_axis=major_axis, minor_axis=minor_axis, copy=copy, dtype=dtype) diff --git a/pandas/tests/generic/test_label_or_level_utils.py b/pandas/tests/generic/test_label_or_level_utils.py index 1ad1b06aaefa2..8b133e654a869 100644 --- a/pandas/tests/generic/test_label_or_level_utils.py +++ b/pandas/tests/generic/test_label_or_level_utils.py @@ -46,7 +46,7 @@ def df_duplabels(df): @pytest.fixture def panel(): - with tm.assert_produces_warning(DeprecationWarning, + with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): return pd.Panel() From 4d1194ddb576b78890b7a697148710fdaceaa5b3 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Mon, 15 Jan 2018 10:10:06 -0500 Subject: [PATCH 2/2] add whatsnew more prominent --- doc/source/whatsnew/v0.23.0.txt | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index 410a8c7bbd8b6..402b85ceb681a 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -225,6 +225,34 @@ If installed, we now require: | openpyxl | 2.4.0 | | +-----------------+-----------------+----------+ +.. _whatsnew_0230.api_breaking.deprecate_panel: + +Deprecate Panel +^^^^^^^^^^^^^^^ + +``Panel`` was deprecated in the 0.20.x release, showing as a ``DeprecationWarning``. Using ``Panel`` will now show a ``FutureWarning``. The recommended way to represent 3-D data are +with a ``MultiIndex`` on a ``DataFrame`` via the :meth:`~Panel.to_frame` or with the `xarray package `__. Pandas +provides a :meth:`~Panel.to_xarray` method to automate this conversion. For more details see :ref:`Deprecate Panel ` documentation. (:issue:`13563`, :issue:`18324`). + +.. ipython:: python + :okwarning: + + p = tm.makePanel() + p + +Convert to a MultiIndex DataFrame + +.. ipython:: python + + p.to_frame() + +Convert to an xarray DataArray + +.. ipython:: python + :okwarning: + + p.to_xarray() + Build Changes ^^^^^^^^^^^^^ @@ -289,7 +317,6 @@ Deprecations - ``Series.valid`` is deprecated. Use :meth:`Series.dropna` instead (:issue:`18800`). - :func:`read_excel` has deprecated the ``skip_footer`` parameter. Use ``skipfooter`` instead (:issue:`18836`) - The ``is_copy`` attribute is deprecated and will be removed in a future version (:issue:`18801`). -- ``Panel`` is now a ``FutureWarning``, previsouly a ``DeprecationWarning`` and will be removed in a future version (:issue:`18324`) .. _whatsnew_0230.prior_deprecations: