nad
nad

Reputation: 2850

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

Upvotes: 0

Views: 823

Answers (1)

MaxU - stand with Ukraine
MaxU - stand with Ukraine

Reputation: 210832

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

Upvotes: 1

Related Questions