Reshaping a DataFrame using Pandas melt()

Hands-on tutorial to change a DataFrame from wide format to long format with Pandas melt()

B. Chen
Towards Data Science
6 min readDec 31, 2021

--

Reshaping is often needed when you work with datasets that contain variables with some kinds of sequences, say, time-series data.

Source from University of Virginia, Research Data Service [1]

--

--