this is my first public question here because I am absolutely lost in this case...
I have an excel file that looks like this:
I applied the following commands to transform the excel file into a dataframe:
df = pd.ExcelFile(r'file_path/excel_file.xlsx')
df = df.parse(sheet_name, header = [0, 1, 2])
Now the problem is that the empty header spaces (in the 'Name', 'ID' and 'Test mode' columns) are being filled with 'Unnamed: 0_level_1'
and 'Unnamed: 1_level_1'
in the first row and 'Unnamed: 0_level_2'
and 'Unnamed: 1_level_2'
and 'Unnamed: 2_level_2'
in the second row.
How can I merge these rows together for every header column so that it just says 'Name', 'ID' and 'Test mode' under the condition that I don't have the opportunity to edit the excel file? So basically I want to merge all header rows where this happens.
Can anyone help me?
Thanks for the help!