如何在python(mac)中打开.tsv文件; UnicodeDecodeError:'utf-8'编解码器无法解码位置2的字节0xbc:无效的起始字节

时间:2018-01-20 15:20:16

标签: python macos utf-8

只是无法读取python中的数据,这是一个.tsv.7z文件,任何抬头都会受到赞赏。我正在使用mac os 10.13 macOS High Sierra。谢谢!

train = pd.read_csv('/Users/sherrymukim/Documents/mercari/train.tsv', sep='\t',encoding='utf-8')

train = pd.read_csv('/Users/sherrymukim/Documents/mercari/train.tsv', sep='\t',encoding='utf-8') Traceback (most recent call last):

File "", line 1, in train = pd.read_csv('/Users/sherrymukim/Documents/mercari/train.tsv', sep='\t',encoding='utf-8')

File "/Users/sherrymukim/anaconda3/lib/python3.6/site-packages/pandas/io/parsers.py", line 655, in parser_f return _read(filepath_or_buffer, kwds)

File "/Users/sherrymukim/anaconda3/lib/python3.6/site-packages/pandas/io/parsers.py", line 405, in _read parser = TextFileReader(filepath_or_buffer, **kwds)

File "/Users/sherrymukim/anaconda3/lib/python3.6/site-packages/pandas/io/parsers.py", line 764, in init self._make_engine(self.engine)

File "/Users/sherrymukim/anaconda3/lib/python3.6/site-packages/pandas/io/parsers.py", line 985, in _make_engine self._engine = CParserWrapper(self.f, **self.options)

File "/Users/sherrymukim/anaconda3/lib/python3.6/site-packages/pandas/io/parsers.py", line 1605, in init self._reader = parsers.TextReader(src, **kwds)

File "pandas/_libs/parsers.pyx", line 562, in pandas._libs.parsers.TextReader.cinit (pandas/_libs/parsers.c:6175)

File "pandas/_libs/parsers.pyx", line 781, in pandas._libs.parsers.TextReader._get_header (pandas/_libs/parsers.c:9691)

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

0 个答案:

没有答案
相关问题