[英]Error tokenizing data with Pandas from a tsv file
I have got dataset named train.tsv.7z
and test.tsv.7z
. 我有一个名为
train.tsv.7z
和test.tsv.7z
数据集。 I unzip them in my Mac with unarchiver (double click) so I have the train.tsv
and test.tsv
now. 我使用unarchiver(双击)将它们解压缩到Mac中,所以现在有了
train.tsv
和test.tsv
。
Then I am reading those files with pandas using 然后我正在使用熊猫阅读那些文件
PATH='data/projData/'
tables = pd.read_table(PATH)
But I am getting error 但是我出错了
ParserError: Error tokenizing data. C error: Calling read(nbytes) on source failed. Try engine='python'.
Looking into other stackoverflow thread, it seems the error is due to the file being corrupted. 调查其他stackoverflow线程,似乎该错误是由于文件已损坏。 But not sure how to solve this issue.
但不确定如何解决此问题。
I am using python3.6 conda environment 我正在使用python3.6 conda环境
It doesn't work this way. 这样行不通。
You have to specify a single file (not a directory): 您必须指定一个文件(而不是目录):
train = pd.read_csv('data/projData/train.tsv', sep='\t')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.