Traceback (most recent call last): File "C:/Users/A11/PycharmProjects/pythonProject1/实验.py", line 23, in <module> studf=pd.read_csv("D:\\python\\film_log3.csv") File "C:\Users\A11\PycharmProjects\pythonProject1\venv\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper return func(*args, **kwargs) File "C:\Users\A11\PycharmProjects\pythonProject1\venv\lib\site-packages\pandas\io\parsers\readers.py", line 586, in read_csv return _read(filepath_or_buffer, kwds) File "C:\Users\A11\PycharmProjects\pythonProject1\venv\lib\site-packages\pandas\io\parsers\readers.py", line 482, in _read parser = TextFileReader(filepath_or_buffer, **kwds) File "C:\Users\A11\PycharmProjects\pythonProject1\venv\lib\site-packages\pandas\io\parsers\readers.py", line 811, in __init__ self._engine = self._make_engine(self.engine) File "C:\Users\A11\PycharmProjects\pythonProject1\venv\lib\site-packages\pandas\io\parsers\readers.py", line 1040, in _make_engine return mapping[engine](self.f, **self.options) # type: ignore[call-arg] File "C:\Users\A11\PycharmProjects\pythonProject1\venv\lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 69, in __init__ self._reader = parsers.TextReader(self.handles.handle, **kwds) File "pandas\_libs\parsers.pyx", line 542, in pandas._libs.parsers.TextReader.__cinit__ File "pandas\_libs\parsers.pyx", line 642, in pandas._libs.parsers.TextReader._get_header File "pandas\_libs\parsers.pyx", line 843, in pandas._libs.parsers.TextReader._tokenize_rows File "pandas\_libs\parsers.pyx", line 1917, in pandas._libs.parsers.raise_parser_error UnicodeDecodeError: 'utf-8' codec can't decode byte 0x87 in position 10: invalid start byte
时间: 2023-07-24 12:14:54 浏览: 189
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这个错误与之前提到的Unicode解码错误相同,导致无法解析CSV文件。你可以尝试之前提到的解决方法来解决此问题。
另外,请确保你不是在读取一个非文本文件,例如一个二进制文件或其他格式的文件。`read_csv()`函数只能用于读取文本文件,如果尝试读取非文本文件可能会导致解码错误。
如果问题仍然存在,请提供更多关于CSV文件的信息,例如文件的大小、内容和编码方式等。这将有助于更好地理解问题并提供准确的解决方案。
阅读全文