Given an excel file data.xlsx
as follows:
I have read it with 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
I wonder if it's possible to transform it to the following format? Thank you for your help.