【问题标题】:Creating ARFF file from CSV manually手动从 CSV 创建 ARFF 文件
【发布时间】:2015-05-12 06:13:46
【问题描述】:

我想基于来自KaggleCSV 创建一个arff 文件

https://www.kaggle.com/c/titanic/download/train.csv

这是我制作的arff 文件的一部分

@relation titanic

@attribute PassengerId numeric
@attribute Survived {0,1}
@attribute Pclass {1,2,3}
@attribute Name string
@attribute Sex {male,female}
@attribute Age numeric
@attribute SibSp numeric
@attribute Parch numeric
@attribute Ticket string
@attribute Fare numeric
@attribute Cabin string
@attribute Embarked {C,Q,S}

@data
1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S
2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",female,38,1,0,PC 17599,71.2833,C85,C
3,1,3,"Heikkinen, Miss. Laina",female,26,0,0,STON/O2. 3101282,7.925,,S
4,1,1,"Futrelle, Mrs. Jacques Heath (Lily May Peel)",female,35,1,0,113803,53.1,C123,S

但是当我在Weka 中加载它时,它会返回这个错误:

nominal value not declared in header, read Token[C85], line 18 % the second line of my data 

我的声明有什么问题?

【问题讨论】:

    标签: csv weka arff


    【解决方案1】:

    问题是名称"Cumings, Mrs. John Bradley (Florence Briggs Thayer)" 中有一个逗号。尽管有双引号,Weka 仍将其解析为两个字段。

    您可以尝试借助正则表达式删除此类逗号(即双引号内的逗号)。

    【讨论】:

      猜你喜欢
      • 2012-06-03
      • 2015-06-24
      • 2011-07-10
      • 2011-07-26
      • 1970-01-01
      • 2012-10-08
      • 2021-10-16
      • 2015-11-23
      • 1970-01-01
      相关资源
      最近更新 更多