python convert arff to csv code example
Example: arff to csv python
#coding=utf-8import pandas as pddef arff_to_csv (fpath): #Read arff data if fpath.find (". arff")<0: print ("the file is nott .arff file") return f=open (fpath) lines=f.readlines () content=[] for l in lines: content.append (l) datas=[] for c in content: cs=c.split (",") datas.append (cs) #Save data in csv file df=pd.dataframe (data=datas, index=none, columns=none) filename=fpath [:fpath.find (". arff")] + ".csv" df.to_csv (filename, index=none)