@@ -144,14 +144,43 @@ def melt(
144
144
@deprecate_kwarg (old_arg_name = "label" , new_arg_name = None )
145
145
def lreshape (data : "DataFrame" , groups , dropna : bool = True , label = None ) -> "DataFrame" :
146
146
"""
147
- Reshape long-format data to wide. Generalized inverse of DataFrame.pivot
147
+ Reshape wide-format data to long. Generalized inverse of DataFrame.pivot.
148
+
149
+ Accepts a dictionary, ``groups``, in which each key is a new column name
150
+ and each value is a list of old column names that will be "melted" under
151
+ the new column name as part of the reshape.
148
152
149
153
Parameters
150
154
----------
151
155
data : DataFrame
156
+ The wide-format DataFrame.
152
157
groups : dict
153
- {new_name : list_of_columns}
154
- dropna : boolean, default True
158
+ {new_name : list_of_columns}.
159
+ dropna : bool, default True
160
+ Do not include columns whose entries are all NaN.
161
+ label : None
162
+ Not used.
163
+
164
+ .. deprecated:: 1.0.0
165
+
166
+ Returns
167
+ -------
168
+ DataFrame
169
+ Reshaped DataFrame.
170
+
171
+ See Also
172
+ --------
173
+ melt : Unpivot a DataFrame from wide to long format, optionally leaving
174
+ identifiers set.
175
+ pivot : Create a spreadsheet-style pivot table as a DataFrame.
176
+ DataFrame.pivot : Pivot without aggregation that can handle
177
+ non-numeric data.
178
+ DataFrame.pivot_table : Generalization of pivot that can handle
179
+ duplicate values for one index/column pair.
180
+ DataFrame.unstack : Pivot based on the index values instead of a
181
+ column.
182
+ wide_to_long : Wide panel to long format. Less flexible but more
183
+ user-friendly than melt.
155
184
156
185
Examples
157
186
--------
@@ -169,10 +198,6 @@ def lreshape(data: "DataFrame", groups, dropna: bool = True, label=None) -> "Dat
169
198
1 Yankees 2007 573
170
199
2 Red Sox 2008 545
171
200
3 Yankees 2008 526
172
-
173
- Returns
174
- -------
175
- reshaped : DataFrame
176
201
"""
177
202
if isinstance (groups , dict ):
178
203
keys = list (groups .keys ())
@@ -262,6 +287,18 @@ def wide_to_long(
262
287
A DataFrame that contains each stub name as a variable, with new index
263
288
(i, j).
264
289
290
+ See Also
291
+ --------
292
+ melt : Unpivot a DataFrame from wide to long format, optionally leaving
293
+ identifiers set.
294
+ pivot : Create a spreadsheet-style pivot table as a DataFrame.
295
+ DataFrame.pivot : Pivot without aggregation that can handle
296
+ non-numeric data.
297
+ DataFrame.pivot_table : Generalization of pivot that can handle
298
+ duplicate values for one index/column pair.
299
+ DataFrame.unstack : Pivot based on the index values instead of a
300
+ column.
301
+
265
302
Notes
266
303
-----
267
304
All extra variables are left untouched. This simply uses
0 commit comments