The data I am working with is in a large set of columns, with related values - for example:
| YearQ | Area A | Area B | Area C |
+--------+--------+--------+--------+
| 2017Q1 | 1234.0 | 9252.0 | 3421.0 |
| 2017Q2 | 1245.0 | 9368.0 | 3321.0 |
| 2017Q3 | 1350.0 | 9440.0 | 3225.0 |
| 2017Q4 | 1333.0 | 9501.0 | 3625.0 |
In order to join this data with another data set, I need to append these values into one column, preserving the Area
column data, as well as the YearQ
data:
| YearQ | Area | Value |
+--------+--------+---------+
| 2017Q1 | Area A | 1234.0 |
| 2017Q1 | Area B | 9252.0 |
| 2017Q1 | Area C | 3421.0 |
| 2017Q2 | Area A | 1245.0 |
| 2017Q2 | Area B | 9368.0 |
| 2017Q2 | Area C | 3321.0 |
I've tried using df.append
and pivot_table
, but am so far unable to get the required result .. which pandas function should I be using here?