UnicodeDecodeError:“ utf-8”编解码器无法解码位置782中的字节0x92:无效的起始字节

时间:2019-05-29 03:12:10

标签: python mysql pandas csv

我正在尝试读取一个csv文件,但发现此错误

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 782: 
invalid start byte

此行中的错误

myOutlook_inBox = pd.read_csv (r'' + mydir + 'test.CSV', usecols= 
['Subject','Body', 'From: (Name)', 'To: (Name)' ])

这是我的后援

Traceback (most recent call last):
File "pandas\_libs\parsers.pyx", line 1169, in 
pandas._libs.parsers.TextReader._convert_tokens
File "pandas\_libs\parsers.pyx", line 1299, in 
pandas._libs.parsers.TextReader._convert_with_dtype
File "pandas\_libs\parsers.pyx", line 1315, in 
pandas._libs.parsers.TextReader._string_convert
File "pandas\_libs\parsers.pyx", line 1553, in 
pandas._libs.parsers._string_box_utf8
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 782: 
invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm 
2019.1.2\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars)  # execute the 
script
File "C:\Program Files\JetBrains\PyCharm 
2019.1.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in 
execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/DELL/PycharmProjects/GUIRef/PyGUI.py", line 12, in <module>
myOutlook_inBox = pd.read_csv (r'' + mydir + 'test.CSV', usecols= 
['Subject','Body', 'From: (Name)', 'To: (Name)' ])
File "C:\Users\DELL\PycharmProjects\GUIRef\venv\lib\site- 
packages\pandas\io\parsers.py", line 702, in parser_f
return _read(filepath_or_buffer, kwds)
File "C:\Users\DELL\PycharmProjects\GUIRef\venv\lib\site- 
packages\pandas\io\parsers.py", line 435, in _read
data = parser.read(nrows)
File "C:\Users\DELL\PycharmProjects\GUIRef\venv\lib\site- 
packages\pandas\io\parsers.py", line 1139, in read
ret = self._engine.read(nrows)
File "C:\Users\DELL\PycharmProjects\GUIRef\venv\lib\site- 
packages\pandas\io\parsers.py", line 1995, in read
data = self._reader.read(nrows)
File "pandas\_libs\parsers.pyx", line 899, in 
pandas._libs.parsers.TextReader.read
File "pandas\_libs\parsers.pyx", line 914, in 
pandas._libs.parsers.TextReader._read_low_memory
File "pandas\_libs\parsers.pyx", line 991, in 
pandas._libs.parsers.TextReader._read_rows
File "pandas\_libs\parsers.pyx", line 1123, in 
pandas._libs.parsers.TextReader._convert_column_data
File "pandas\_libs\parsers.pyx", line 1176, in 
pandas._libs.parsers.TextReader._convert_tokens
File "pandas\_libs\parsers.pyx", line 1299, in 
pandas._libs.parsers.TextReader._convert_with_dtype
File "pandas\_libs\parsers.pyx", line 1315, in 
pandas._libs.parsers.TextReader._string_convert
File "pandas\_libs\parsers.pyx", line 1553, in 
pandas._libs.parsers._string_box_utf8
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 782: 
invalid start byte

0 个答案:

没有答案