I have a pandas data frame with columns for a collection of locations, i.e. "station 1", "station 2", etc., for which each entry is a demand data value. It looks like this:
index station 1 station 2
0 0.1 1.2
1 -0.04 0.9
I'd like to create a new dataframe with columns "station" that has station entries and "demand' that has the corresponding data value. Like this
index station demand
0 station 1 0.1
1 station 1 -0.4
2 station 2 1.2
3 station 2 0.9
How can I do this using pandas built-in dataframe manipulation?
I've tried using the melt and wide_to_long functions, but I don't really think these are what I need