Pandas melt()The Pandas.melt() function is used to unpivot the DataFrame from a wide format to a long format. Its main task is to massage a DataFrame into a format where some columns are identifier variables and remaining columns are considered as measured variables, are unpivoted to the row axis. It leaves just two non-identifier columns, variable and value. SyntaxParameters
ReturnsIt returns the unpivoted DataFrame as the output. ExampleOutput Name Language Age 0 Parker Python 22 1 Smith Java 30 2 John C++ 26 Example2Output A myVarname myValname 0 p C 56 1 q C 62 2 r C 42 Next TopicDataFrame.merge() |