我正在尝试使用来自GUI的Weka的CSVLoader将CSV转换为ARFF。在选项中,我将字符串的机箱字符设置为"
,尽管我的文件中没有引号。
我收到以下错误:
weka.core.converters.CSVLoaderfailed to lead <my file>
Reason:
wrong number of values. Read 2, expected 23, read Token[EOL], line 1763
以下是第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
有什么想法吗?我似乎无法找到错误。
EDIT---
当然,我发布后发现“错误”CSVLoader不喜欢%字符。所以,我改变了我的问题:有谁知道这是为什么或其他角色不喜欢它?
答案 0 :(得分:13)
如果用作数据
,这些字符通常会导致问题,=“'* + - %
答案 1 :(得分:4)
在R语言中使用此代码并更改文件,它将解决您的问题100%
mydata=read.csv("train.csv",header=TRUE)
library("foreign")
write.arff(x =mydata ,file= "train.arff")
答案 2 :(得分:2)
错误是由第1763行的撇号引起的。