Unparseable date 'yyyy-MM-dd HH:mm:ss' during importing ARFF file

1.1k views Asked by At

I'm trying to import an arff file using Java Weka Api but it gives me an error:

DataSource source = new DataSource("C:/Users/user/Documenti/file.arff");
Instances dataset = source.getDataSet();

java.io.IOException: unparseable date: 2014-03-30 02:00:00, read Token[2014-03-30 02:00:00], line 8001 at weka.core.converters.ArffLoader$ArffReader.errorMessage(ArffLoader.java:354) at weka.core.converters.ArffLoader$ArffReader.getInstanceFull(ArffLoader.java:744) at weka.core.converters.ArffLoader$ArffReader.getInstance(ArffLoader.java:545) at weka.core.converters.ArffLoader$ArffReader.readInstance(ArffLoader.java:514) at weka.core.converters.ArffLoader$ArffReader.readInstance(ArffLoader.java:500) at weka.core.converters.ArffLoader.getDataSet(ArffLoader.java:1240) at weka.core.converters.ConverterUtils$DataSource.getDataSet(ConverterUtils.java:269)

The structure of the arff file is the following:

@attribute id numeric
@attribute idsito numeric
@attribute lat numeric
@attribute lon numeric
@attribute data date 'yyyy-MM-dd HH:mm:ss'

The line 8001 of the arff file is the following:

265294,5,40.802742,16.894081,'2014-03-30 02:00:00'

The import of previous instances is fine but I do not understand why exactly at line 8001 that gives me problems.

1

There are 1 answers

1
TmTron On

I think the data is invalid. 30-March 2014 was the last Sunday in March which is the date where the Daylight Savings Time change occurs in many Countries: e.g. the clock may be set from 1:00 to 3:00 - depending on your time-zone of course.

So maybe you must tell your library which time-zone to use.