Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong number of values when importing csv in Weka

Tags:

csv

dataset

weka

I want to open a csv file (saved from openoffice calc) in weka.

I keep getting an error: "wrong number of values. 140 read, 139 expected on line 3."

The csv was already fixed with quotes around the labels. And I count 140 values on the first lines.

What is wrong here?

Link to the file.

like image 754
dorien Avatar asked Nov 18 '13 15:11

dorien


4 Answers

Turns out there was an value somewhere for beyond sight in the excel file I was exporting.

I noticed it because all the rows ended with a comma instead of nothing.

Carefully selected only the right reach, copied in a document and works.

Hope this helps somebody else as well.

like image 175
dorien Avatar answered Oct 02 '22 18:10

dorien


I had the same error.!!!! I found the solution.

Just remove all the double-quote, single-quote from the .csv, .xls file.

i,e for eg. under the Name column if the value is "john" it throws an error. Make it to john by removing the quotes.

To remove all the quotes, go to the excel file FInd and replace box.

Find what - "

Replace with - (empty space)

like image 29
callyaser Avatar answered Oct 02 '22 17:10

callyaser


I also went through the same problem when I was using Weka and importing a csv file.

The problem is with the wrong formatting of the file

In my file there was a word in one of the columns GOV'T what I just did was removed the "'" and wrote a whole word GOVERNMENT and it worked.

Hope this helps !!

like image 20
Nitesh Joshi Avatar answered Oct 02 '22 16:10

Nitesh Joshi


I had the same error. Problem was a sigle quote character in a string value. Solution for me was to eclose the whole string value in double quotes.

So I have to convert

              this: ...,Uncharted 3: Drake's Deception,...

           to this: ...,"Uncharted 3: Drake's Deception",...

using weka v. 3.8.0

like image 44
Konstantinos Raptis Avatar answered Oct 02 '22 18:10

Konstantinos Raptis