Wrong number of values when importing csv in Weka
Asked Answered
S

10

6

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.

Sauder answered 18/11, 2013 at 15:28 Comment(1)
The question contains a link that is dead. Please, fix it and put the right link to the file which gives a point to this question.Mistrot
S
14

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.

Sauder answered 18/11, 2013 at 15:34 Comment(0)
U
4

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)

Upbringing answered 2/8, 2015 at 2:48 Comment(1)
There are no double/single quotes on my dataset, but still the same error occurs.Lafferty
D
1

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 !!

Deyoung answered 1/4, 2016 at 19:57 Comment(0)
I
1

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

Intreat answered 29/4, 2017 at 18:14 Comment(0)
P
0

This is because of addition of extra column. So to get rid of that error, select whole of that column and delete that column. That should work fine. :)

Pereira answered 1/5, 2015 at 23:0 Comment(0)
C
0

I also encountered with that error. My csv file contains floating numbers. I have solved that problem by replacing "," with "." .

Clinton answered 28/10, 2016 at 21:45 Comment(0)
B
0

For me all of the above worked. I replaced " ' , with space.

Burgener answered 15/3, 2017 at 6:42 Comment(0)
K
0

I had the same error before. I changed my .xls files without any blank ranks. Sometimes the Weka loaded too many "," . But if I clear the blank ranks than the Weka could be work.

Kultur answered 29/5, 2017 at 8:51 Comment(0)
A
0

If you have copied data from another file using Conrol+A, Control+C and control+V, you copied extra columns. if you open csv file in Nodepad you will see comma in the end of each row. you got this error because of the comma in the end of each row.

To avoid this error, press Control and select columns one by one then Control+C now copy it to new File which you will use in weka. or you can use another method to avoid comma in the end of each row.

Astri answered 30/6, 2018 at 13:8 Comment(0)
G
0

I encountered the same problem. Replacing/ erasing all " and ' with space worked for me!

Goldarn answered 18/6, 2022 at 22:8 Comment(1)
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewShinberg

© 2022 - 2024 — McMap. All rights reserved.