I have some data in an excel sheet shown in picture below that I want to read as dataframe using pandas.read_excel
, however the function skips automatically the first 2 rows of the sheet as shown in image below. I can't figure out the problem source? and how can I solve it?
the following code is used:
import pandas as pd
import tkinter as Tk
from tkinter.filedialog import askopenfilename
from tabulate import tabulate
print("Choose the desired Source file:")
Tk.Tk().withdraw()
path1 = askopenfilename() # the path to the file I want to use
source_workbook = pd.read_excel(path1, header=1, engine='openpyxl')
print(tabulate(source_workbook,headers='firstrow'))
The above code produces this result:
When I change the position of the excel table as shown below, the function produces the desired data frame shown in the image below also.