Skip to content

Commit 1595e4a

Browse files
committed
DOC: Improve melt example (pandas-dev#23844)
1 parent dc8d35a commit 1595e4a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

doc/source/_static/reshaping_melt.png

-12.9 KB
Loading

doc/source/reshaping.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,11 @@ For instance,
303303
304304
cheese = pd.DataFrame({'first': ['John', 'Mary'],
305305
'last': ['Doe', 'Bo'],
306-
'height': [5.5, 6.0],
307-
'weight': [130, 150]})
306+
'A': [5.5, 6.0],
307+
'B': [7, 9]})
308308
cheese
309309
cheese.melt(id_vars=['first', 'last'])
310-
cheese.melt(id_vars=['first', 'last'], var_name='quantity')
310+
cheese.melt(id_vars=['first', 'last'], var_name='treatment')
311311
312312
Another way to transform is to use the :func:`~pandas.wide_to_long` panel data
313313
convenience function. It is less flexible than :func:`~pandas.melt`, but more

0 commit comments

Comments
 (0)