O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Melting data to and from long and wide format

Melting is a type of un-pivoting, and is often referred to as changing a DataFrame object from wide format to long format. This format is common in various statistical analyses, and data you read may be already provided in a melted form. Or you may need to pass data in this format to other code that expects this organization.

Technically, melting is the process of reshaping a DataFrame object into a format where two or more columns, referred to as variable and value, are created by un-pivoting column labels in the variable column, and then moving the data from these columns into the appropriate location in the value column. All other columns are then made into identifier columns that assist in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required