pandas讀取excel亂碼報錯

笑而不语心自闲發表於2024-05-24

如題,pandas讀取excel時出現"No codepage record..."錯誤

解決方法:

# 用xlrd開啟excel檔案,指定encoding_override為gbk或者其它編碼格式
wb = xlrd.open_workbook_xls(file_name, encoding_override='gbk')
df = pd.read_excel(wb, header=None, skiprows=1)

相關文章