如何在Java中将csv文件转换为arff?

时间:2014-12-13 09:04:42

标签: java csv weka arff

当我尝试将CS​​V文件转换为ARFF时,我收到以下错误消息。我该如何解决这个问题?

---Registering Weka Editors---
    Trying to add database driver (JDBC): RmiJdbc.RJDriver - Error, not in CLASSPATH?
    Trying to add database driver (JDBC): jdbc.idbDriver - Error, not in CLASSPATH?
    Trying to add database driver (JDBC): com.mckoi.JDBCDriver - Error, not in CLASSPATH?
    Trying to add database driver (JDBC): org.hsqldb.jdbcDriver - Error, not in CLASSPATH?
    Exception in thread "main" java.lang.IllegalArgumentException: Attribute names are not unique! Causes: 'þÿÿÿ' 'á' '°' '=' '$' '$' '$' '$' '$' '$' '$' '$' '$' '$' '-' '$' '$' '$' '* ' '-' '-' 
        at weka.core.Instances.<init>(Instances.java:252)
        at weka.core.converters.CSVLoader.readHeader(CSVLoader.java:979)
        at weka.core.converters.CSVLoader.readStructure(CSVLoader.java:610)
        at weka.core.converters.CSVLoader.getStructure(CSVLoader.java:595)
        at weka.core.converters.CSVLoader.getDataSet(CSVLoader.java:628)
        at ConvertToArff.Convert(ConvertToArff.java:22)
        at ConvertToArff.main(ConvertToArff.java:35)

1 个答案:

答案 0 :(得分:0)

根据您的例外情况,您的某个属性具有多个同名标签。如果它们可以保持唯一,则不应再继续这个问题。

如果这不是问题,请发布更多代码和/或数据(仅在例外情况下诊断非常困难)。

希望这有帮助!