I am defining a pandas dataframe by reading an excel file saved locally:
df_names = pd.read_excel(r'path/NAMES.xlsx', "Sheet1")
I am using pandas. However the above line leads to this error:
raise ValueError("File is not a recognized excel file")
Any help would be greatly appreciated. I realise the fact it is a xlsx file complicates things but i don't really want to use xls files.
If it is a valid xlsx file then then issue could be related to the pandas version; you can try by explicitly using openpyxl. Assuming you have openpyxl installed then please try:
df_names = pd.read_excel(r'path/NAMES.xlsx',sheet_name= "Sheet1", engine='openpyxl')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.