Melt
pandas.melt, Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
Melt from pandas
input : Table
output : Table
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
This function is useful to massage a DataFrame into a format where one or more columns are identifier variables (id_vars), while all other columns, considered measured variables (value_vars), are “unpivoted” to the row axis, leaving just two non-identifier columns, 'variable' and 'value'. Do not handle multi-index columns.
Input
Output
Configuration
id_vars
Column(s) to use as identifier variables.
list
value_vars
Column(s) to unpivot. If not specified, uses all columns that are not set as *id_vars*.
list
var_name
Name to use for the 'variable' column. If None it uses `frame.columns.name` or 'variable'.
string
value_name
Name to use for the 'value' column.
string
value
col_level
If columns are a MultiIndex then use this level to melt.
string
ignore_index
If True, original index is ignored. If False, the original index is retained. Index labels will be repeated as necessary.
bool
true