I'm new using pandas and I'm tring to use pandas read excel to work with a file as a df. The spreadsheet looks like this:
The problem is that this file contains double headers in the colums and rows and the first header for each of them include merged cells. I tried this:
file = 'country_sector_py.xlsx'
matrix = pd.read_excel(file, sheet_name = 'matrix', header=[0, 1], index_col=[0, 1])
the error I get is "ValueError: Length of new names must be 1, got 2." I've read some related posts that says it's due to some the headers are repeated, but I haven't been able to solve it. any guide would be much appreciated.
References:
Pandas read excel sheet with multiple header when first column is empty