Skip to content

Commit 47f7049

Browse files
jbrockmendelproost
authored andcommitted
DEPR: deprecate label kwarg to lreshape, closes pandas-dev#29742 (pandas-dev#30219)
1 parent cc13a73 commit 47f7049

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

doc/source/whatsnew/v1.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ Deprecations
490490
- :func:`eval` keyword argument "truediv" is deprecated and will be removed in a future version (:issue:`29812`)
491491
- :meth:`Categorical.take_nd` is deprecated, use :meth:`Categorical.take` instead (:issue:`27745`)
492492
- The parameter ``numeric_only`` of :meth:`Categorical.min` and :meth:`Categorical.max` is deprecated and replaced with ``skipna`` (:issue:`25303`)
493+
- The parameter ``label`` in :func:`lreshape` has been deprecated and will be removed in a future version (:issue:`29742`)
493494
-
494495

495496
.. _whatsnew_1000.prior_deprecations:

pandas/core/reshape/melt.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import numpy as np
55

6-
from pandas.util._decorators import Appender
6+
from pandas.util._decorators import Appender, deprecate_kwarg
77

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

124124

125+
@deprecate_kwarg(old_arg_name="label", new_arg_name=None)
125126
def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> DataFrame:
126127
"""
127128
Reshape long-format data to wide. Generalized inverse of DataFrame.pivot
@@ -132,8 +133,6 @@ def lreshape(data: DataFrame, groups, dropna: bool = True, label=None) -> DataFr
132133
groups : dict
133134
{new_name : list_of_columns}
134135
dropna : boolean, default True
135-
label : object, default None
136-
Dummy kwarg, not used.
137136
138137
Examples
139138
--------

pandas/tests/reshape/test_melt.py

+3
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@ def test_pairs(self):
553553
exp = DataFrame(exp_data, columns=result.columns)
554554
tm.assert_frame_equal(result, exp)
555555

556+
with tm.assert_produces_warning(FutureWarning):
557+
result = lreshape(df, spec, dropna=False, label="foo")
558+
556559
spec = {
557560
"visitdt": ["visitdt{i:d}".format(i=i) for i in range(1, 3)],
558561
"wt": ["wt{i:d}".format(i=i) for i in range(1, 4)],

0 commit comments

Comments
 (0)