The following dataframe have multiple column names with format item:district:
date price:dc price:xc price:cy ratio:dc ratio:xc ratio:cy
0 2017 12 11 14 0.1 0.1 0.3
1 2018 14 12 15 0.2 0.7 0.6
2 2019 13 13 16 0.5 -0.2 0.8
Is it possible to convert it to a new dataframe as follows? Thanks.
date district price ratio
0 2017 dc 12 0.1
1 2018 dc 14 0.2
2 2019 dc 13 0.5
3 2017 xc 11 0.1
4 2018 xc 12 0.7
5 2019 xc 13 -0.2
6 2017 cy 14 0.3
7 2018 cy 15 0.6
8 2019 cy 16 0.8