10

我正在尝试使用 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 不喜欢% 字符。所以,我改变了我的问题:有谁知道这是为什么,或者其他角色不喜欢它吗?

4

3 回答 3

15

如果将这些字符用作数据,通常会导致问题

, = " ' *+ -%

于 2014-03-14T20:51:25.407 回答
4

在 R 语言中使用此代码并更改文件它将 100% 解决您的问题

mydata=read.csv("train.csv",header=TRUE)
library("foreign")
write.arff(x =mydata ,file= "train.arff")
于 2016-06-17T13:48:38.093 回答
3

该错误是由第 1763 行中的撇号引起的。

于 2015-07-28T20:32:49.490 回答