Okay here I go! I am such a noob by the way and I am trying my best to learn. I had to write a little code to open a csv file and format the list such a way that it would work with Libsvm but anyway this is the code I wrote so far :
import csv
with open ('testingSeta.csv')as csvfile:
reader = csv.reader(csvfile, delimiter = ',')
for i in reader:
i.insert (0, i.pop(13))
print (" ".join(i))
and this gives me a list like this:
-1 0 1 1 0 1 1 1 4 5 6 5 5 8
-1 0 1 0 0 1 1 1 4 3 7 1 3 6
1 3 7 2 0 4 4 1 41 46 86 20 18 48
1 10 11 0 0 6 6 3 26 65 102 25 16 38
testingSeta.csv original format:
0,1,1,0,1,1,1,4,5,6,5,5,8,-1
0,1,0,0,1,1,1,4,3,7,1,3,6,-1
3,7,2,0,4,4,1,41,46,86,20,18,48,1
10,11,0,0,6,6,3,26,65,102,25,16,38,1
I would like the list to be ordered like this:
-1 1:0 2:1 3:1 4:0 5:1 6:1 7:1 8:4 9:5 10:6 11:5 12:5 13:8
-1 1:0 2:1 3:0 4:0 5:1 6:1 7:1 8:4 9:3 10:7 11:1 12:3 13:6
1 1:3 2:7 3:2 4:0 5:4 6:4 7:1 8:41 9:46 10:86 11:20 12:18 13:48
1 1:10 2:11 3:0 4:0 5:6 6:6 7:3 8:26 9:65 10:102 11:25 12:16 13:38
the numbering '1:' should always start from the second number/value. Can any body help? thanks for your time