DataFrame.
melt
Unpivot a DataFrame from wide format to long format, optionally leaving identifier columns set. This is the reverse to groupBy(…).pivot(…).agg(…), except for the aggregation, which cannot be reversed.
melt() is an alias for unpivot().
melt()
unpivot()
New in version 3.4.0.
Column(s) to use as identifiers. Can be a single column or column name, or a list or tuple for multiple columns.
Column(s) to unpivot. Can be a single column or column name, or a list or tuple for multiple columns. If not specified or empty, use all columns that are not set as ids.
Name of the variable column.
Name of the value column.
DataFrame
Unpivoted DataFrame.
See also
DataFrame.unpivot