Excel file format cannot be determined, you must specify an engine manually.
时间: 2023-09-21 07:10:34 浏览: 333
This error message typically occurs when reading an Excel file using pandas and the file format cannot be determined automatically. To solve this issue, you need to specify the engine parameter in the read_excel() function, and set it to either "openpyxl" or "xlrd", depending on the version of Excel file you are trying to read.
For example, if you are trying to read an Excel file using pandas and the file format is .xlsx, you can use the following code:
```
import pandas as pd
df = pd.read_excel('filename.xlsx', engine='openpyxl')
```
If the file format is .xls, you can use the following code:
```
import pandas as pd
df = pd.read_excel('filename.xls', engine='xlrd')
```
By specifying the engine parameter, you can ensure that pandas uses the correct library to read the Excel file and avoid the error message.
阅读全文