Skip to content

DEPR: deprecate label kwarg to lreshape, closes #29742 #30219

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
Dec 12, 2019
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
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ Deprecations
- :func:`eval` keyword argument "truediv" is deprecated and will be removed in a future version (:issue:`29812`)
- :meth:`Categorical.take_nd` is deprecated, use :meth:`Categorical.take` instead (:issue:`27745`)
- The parameter ``numeric_only`` of :meth:`Categorical.min` and :meth:`Categorical.max` is deprecated and replaced with ``skipna`` (:issue:`25303`)
- The parameter ``label`` in :func:`lreshape` has been deprecated and will be removed in a future version (:issue:`29742`)
-

.. _whatsnew_1000.prior_deprecations:
Expand Down
5 changes: 2 additions & 3 deletions pandas/core/reshape/melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from pandas.util._decorators import Appender
from pandas.util._decorators import Appender, deprecate_kwarg

from pandas.core.dtypes.common import is_extension_array_dtype, is_list_like
from pandas.core.dtypes.concat import concat_compat
Expand Down Expand Up @@ -122,6 +122,7 @@ def melt(
return frame._constructor(mdata, columns=mcolumns)


@deprecate_kwarg(old_arg_name="label", new_arg_name=None)
def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> DataFrame:
"""
Reshape long-format data to wide. Generalized inverse of DataFrame.pivot
Expand All @@ -132,8 +133,6 @@ def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> DataFr
groups : dict
{new_name : list_of_columns}
dropna : boolean, default True
label : object, default None
Dummy kwarg, not used.

Examples
--------
Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/reshape/test_melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,9 @@ def test_pairs(self):
exp = DataFrame(exp_data, columns=result.columns)
tm.assert_frame_equal(result, exp)

with tm.assert_produces_warning(FutureWarning):
result = lreshape(df, spec, dropna=False, label="foo")

spec = {
"visitdt": ["visitdt{i:d}".format(i=i) for i in range(1, 3)],
"wt": ["wt{i:d}".format(i=i) for i in range(1, 4)],
Expand Down