解决 Pandas read_excel 错误:'Worksheet named 'Sheet1' not found'
This error occurs when the specified sheet name 'Sheet1' is not found in the Excel file '集成杆外挂设备详情.xlsx'. This could be due to a typo in the sheet name or the sheet not existing in the file.
To resolve this error, you can try the following:
-
Check the spelling and capitalization of the sheet name. Make sure it matches the actual name of the sheet in the Excel file.
-
Open the Excel file and verify that the sheet exists. If it doesn't, create a new sheet with the desired name or change the sheet name in the code to match an existing sheet.
-
If the Excel file has multiple sheets, try specifying the sheet index instead of the sheet name. For example, df = pd.read_excel('集成杆外挂设备详情.xlsx', sheet_name=0) will read the first sheet in the file.
-
If none of the above solutions work, try opening the Excel file in a different program or converting it to a different format (e.g. CSV) and reading it with pandas.
原文地址: https://www.cveoy.top/t/topic/jmEe 著作权归作者所有。请勿转载和采集!