UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 10: invalid start byte
时间: 2023-09-29 18:02:40 浏览: 94
这个错误是由于在解码时尝试使用utf-8编码对字节进行解码,但是在位置10处的字节0xb6被认为是无效的开始字节。要解决这个问题,需要更改读取文件时的编码格式。常见的编码格式包括ascii、gb18030、gbk和gb2312。你可以尝试使用不同的编码格式来读取文件,例如使用gb18030编码:stock = pd.read_csv(r'文件路径', encoding="gb18030")。这样就可以避免UnicodeDecodeError错误的发生。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 2: invalid continuation byte-...](https://download.csdn.net/download/weixin_42204453/15589184)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [报错:UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb0 in position 2: invalid start byte](https://blog.csdn.net/m0_56230003/article/details/130326974)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文