“utf-8"编解码器无法解码位置 1 中的字节 0xdb: [英] 'utf-8' codec can't decode byte 0xdb in position 1:
本文介绍了“utf-8"编解码器无法解码位置 1 中的字节 0xdb:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码给了我一个
将pandas导入为pdpath = 'C:\\Users\\vlac284\\Desktop\\Lighting\\sample_Myer\\sample_2.xlsxdf = pd.read_csv(路径)
<块引用>
UnicodeDecodeError: 'utf-8' 编解码器无法解码位置 1 的字节 0xdb:连续字节无效
类似的帖子没有帮助.
解决方案
您有一个 Excel 格式文件 (.xlsx) 并且您正试图将其读取为 csv (read_csv).它们是 2 种不同的格式……这是行不通的.
将您的 Excel 文件另存为 .csv 或使用读取 Excel 的库/方法.
The following code gives me a
import pandas as pd
path = 'C:\\Users\\vlac284\\Desktop\\Lighting\\sample_Myer\\sample_2.xlsx
df = pd.read_csv(path)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdb in position 1: invalid continuation byte
Similar postings did not help.
解决方案
You have an Excel format file (.xlsx) and you are trying to read it as csv (read_csv). They are 2 different formats... that will not work.
Either save your Excel file as .csv or use a library / method that reads Excel.
这篇关于“utf-8"编解码器无法解码位置 1 中的字节 0xdb:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文