Учитывая файл Excel data.xlsx
следующим образом:
![enter image description here](https://i.stack.imgur.com/sP09P.png)
Я прочитал его с df = pd.read_excel('data.xlsx', header = [0, 1], index_col = [0, 1], sheet_name = 'Sheet1')
,
Out :
district 2018 2019
price ratio price ratio
bj cy 12 0.01 6 0.02
sh hp 4 0.02 3 0.05
Интересно, возможно ли преобразовать его в следующий формат? Спасибо за вашу помощь.
![enter image description here](https://i.stack.imgur.com/8YFt3.png)