Hi everyone!
I want to write a list of 2500 numbers into csv file.
From the code below, I only manage to get the list written in one row with 2500 columns in total. My expectation is to have 25 columns, where after every 25 numbers, it will begin to write into the next row.
Expected:
0.81 0.87 0.17 0.31......... 0.76(25th)
0.31.........................0.10(50th)
What I have tried:
csv_output = csv.writer(open("c.csv", "wb"))
csv_output.writerow(["Col1","Col2","Col3","Col4","Col5","Col6","Col7","Col8","Col9","Col10","Col11","Col12","Col13","Col14","Col15","Col16","Col17","Col18","Col19","Col20","Col21","Col22","Col23","Col24","Col25"])
i=0
for row in csv_f2:
print ("Superpixel features",row)
a = float(row[0])
for row2 in csv_f1:
b = float(row2[i])
c = (b-a)
print ("%.8f, %.8f, %.8f" % (a, b, c))
# save the feature vector using CSV
outputf = ([c])
outf.append(outputf)
csv_output.writerow(outf)
f1.seek(0)
i=i+1