pandas读取excel时zipfile.BadZipFile: File is not a zip file
时间: 2023-10-14 14:03:22 浏览: 331
当使用pandas读取Excel文件时出现"zipfile.BadZipFile: File is not a zip file"错误的原因是你提供给pandas的文件路径可能不正确或者是一个损坏的zip文件。请确保你提供给pandas的文件路径是正确的,并且文件确实是一个有效的Excel文件而不是zip文件。此外,你也可以尝试使用engine参数指定使用openpyxl引擎来读取Excel文件,例如:df1 = pd.read_excel(filename, engine='openpyxl', index_col=0)。这样可以避免使用默认引擎可能导致的一些问题。希望这些解决方法对你有帮助。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [解决pandas读取上传的excel报错BadZipFile(“File is not a zip file“) zipfile.BadZipFile: File is not ...](https://blog.csdn.net/weixin_42008966/article/details/128095320)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [操作文件时报错:zipfile.BadZipFile: File is not a zip file](https://blog.csdn.net/qq_45166384/article/details/117749334)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文