pandas读取csv文件报错UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd7 in position 1: invalid continuation byte
时间: 2023-08-26 15:15:03 浏览: 140
解决Python中pandas读取*.csv文件出现编码问题
在使用pandas读取csv文件时,报错UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd7 in position 1: invalid continuation byte。这个错误通常是由于文件的编码格式与pandas默认的utf-8编码格式不兼容所导致的。
解决这个问题的方法是指定正确的编码格式,可以尝试以下几种方法来解决该问题:
1. 使用encoding参数指定正确的编码格式,例如使用encoding='gbk'来读取文件。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *3* [Python 读取csv文件时报错:UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xd0 in position 0:...](https://blog.csdn.net/qq_57329395/article/details/127876035)[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^chatsearchT0_1"}} ] [.reference_item]
- *2* [python读取csv文件报错 UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd5 in position 0: ...](https://blog.csdn.net/fengyuyeguirenenen/article/details/129053880)[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^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文