I have made a classifier in Python and it works fine. Now I need to output the results into a text file, which I can also do without a problem. The problem is, I need to include the id of the result as well as the result itself. I am new to python and still getting used to the syntax so any help would be greatly appreciated.
printedRow = '{id1},{result1}'.format(id1=id , result1 = result)
print("~~~~~RESULT~~~~~")
for k in range(0,len(pans)):
pans.append(row[0] + ','+ p.classify(row))
print (pans)
print(pans, file=outfile)
The id that I need to include with the results of the classifier is being held in the index row[0]. When I run this code, the same id is printed with every result. The results are printing out fine, I just need to be able to match the id with the result.
They are both held in lists and there are about 2000 values in each list.