I have an Excel file with merged columns and rows, and I want to read the excel file and parse it to convert it into a DataFrame.
This is just a small example of what happend because the real data that I have is pretty big with lots of tables.
This is what the Excel file looks like :
Excel File
When I tried xl = pd.read_excel('file')
I got this :
Python
As you can see, the merged rows gave me NaN and the merges cols gave me “Unnamed:”.
When I try the parse function (which I use for my data instead of read_excel)
xls = pd.ExcelFile('/content/test.xlsx')
entire_sheet = xls.parse(sheet_name='Feuille 1')
df.append(entire_sheet)```
I get this :
[Python](https://i.sstatic.net/DdNLA8Y4.png)
So it's the same problem with NaN rows and Unnamed cols.
**I want the DF in Python to look exactly like the Excel sheet**. What should I do?
RMB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.