且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“utf-8"编解码器无法解码位置 1 中的字节 0xdb:

更新时间:2022-10-15 08:49:02

您有一个 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.