I am using the Weka Java library to read in a CSV file and convert it to an ARFF file .
The problem is that the CSV file does not have a header line , but only data. How to assign attribute names after entering CSV file? (all columns will be string data types)
Here is the code that I still have:
CSVLoader loader = new CSVLoader();
loader.setSource(new File(CSVFilePath));
Instances data = loader.getDataSet();
ArffSaver saver = new ArffSaver();
saver.setInstances(data);
saver.setFile(new File(outputFilePath));
saver.writeBatch();
I tried to look at the Weka source code to figure it out, but I could not make heads or tails out of it: - (
source
share