Reputation: 2946
I would like to transfer a data file to .arff file. I am using Weka software for my project.
I found few transfer methods on the Internet.
I can change the file extension from save as option of a file.
I can change the data file to .csv and then open it using Weka -> tools -> arff views then save it as .arff file.
These two methods did not work.
I got the error after saving the file .arff and then try to open it.
Link for data file this link
Link for csv file this link
code to transfer data file to csv
import pandas as pd
data = pd.read_csv('breast-cancer-wisconsin.data')
data.columns = ['code','Clump Thickness','UniformityOfCellSize','UniformityOfCellShape','MarginalAdhesion','SingleEpithelialCellSize','BareNucloi','BlandChromatin','NormalNucleoli','Mitoses','Class']
data.to_csv('breast-cancer-wisconsin.csv', index=False, encoding='utf-8')
Now I would like to know how can I transfer data file into .arff?
Solution link did not help.
Thank you
Upvotes: 0
Views: 784
Reputation: 2608
@StatsPy gave you a correct answer for how you can convert your CSV file using the command-line.
Here are the steps how you can do that in the Weka user interface:
I'm not familiar with that dataset, but it might be the case that not all attributes should be treated as numeric (e.g., the class attribute). If that is the case, then you can use the NumericToNominal filter in the Preprocess panel to convert the relevant attribute indices (1-based) to nominal ones.
Once you are done, you can save your dataset by clicking on Save... (just make sure your file type in the save dialog is set to ARFF data files) and providing a file name.
Upvotes: 1
Reputation: 794
Did you try: java -cp /path to weka.jar weka.core.converters.CSVLoader file.csv > file.arff ?
Upvotes: 1