fiacobelli
fiacobelli

Reputation: 1990

Weka CSVLoader wrong number of values. Read 2, expected 23

I am trying to convert a CSV to ARFF using Weka's CSVLoader from the GUI. In the options I set the enclosure character for strings to be ", although there are no quotes in my file. I get the following error:

weka.core.converters.CSVLoaderfailed to lead <my file>
Reason:
wrong number of values. Read 2, expected 23, read Token[EOL], line 1763

Here are lines 1762-1764:

450c787001b004af69428e267c7a4ca1,I_need need_to to_go go_back back_to to_my my_live live_food food_diet diet_PPP PPP_Not Not_90% 90%_like like_before before_CCC CCC_but but_I I_bet bet_I I_could could_do do_75% 75%_without without_losing losing_too too_much much_weight weight_PPP PPP_PPP,2.30,3.50,4.50,2.85,4.50,n,y,y,n,y,AM,297,41728.8,95.58,0.03,42826,0.49,0.17,-12.5611111111,0.248945147679,0.0595238095238
450c787001b004af69428e267c7a4ca1,It's_ugly ugly_here here_PPP PPP_But But_there there_are are_sparks sparks_PPP PPP_PPP PPP_PPPmoments PPPmoments_PPP PPP_Love Love_PPP,2.30,3.50,4.50,2.85,4.50,n,y,y,n,y,AM,297,41728.8,95.58,0.03,42826,0.49,0.17,-15.91,0.299242424242,0.1
450c787001b004af69428e267c7a4ca1,I_guess guess_it it_all all_depends depends_on on_your your_mood mood_PPP PPP_PPP PPP_PPPwhy PPPwhy_can't can't_these these_meds meds_be be_any any_damn damn_good good_QQQ,2.30,3.50,4.50,2.85,4.50,n,y,y,n,y,AM,297,41728.8,95.58,0.03,42826,0.49,0.17,-12.9970588235,0.0,0.0344827586207

Any ideas? I can't seem to find the error.

EDIT---

Of course, right after I posted I found the "error" The CSVLoader does not like the % characters. So, I've changed my question: Does anyone know why this is or what other characters are not liked by it?

Upvotes: 10

Views: 19661

Answers (3)

javac
javac

Reputation: 2999

use this code in R language and change file it will solve your problem 100%

mydata=read.csv("train.csv",header=TRUE)
library("foreign")
write.arff(x =mydata ,file= "train.arff")

Upvotes: 4

Dr James
Dr James

Reputation: 31

The error is caused by the apostrophe in line 1763.

Upvotes: 3

user3202132
user3202132

Reputation: 179

these characters usually cause problems if being used as data

, = " ' *+ -%

Upvotes: 15

Related Questions