简体   繁体   中英

Error tokenizing data with Pandas from a tsv file

I have got dataset named train.tsv.7z and test.tsv.7z . I unzip them in my Mac with unarchiver (double click) so I have the train.tsv and test.tsv now.

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. But not sure how to solve this issue.

I am using python3.6 conda environment

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')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM