I'm trying to replace the first line of a csv input file with a header. The first line is blank, 0. See image below.
I want the blank and 0 to be "ID" and "sil_score" respectively. See below:
But I keep getting this:
import csv
r = csv.reader(open('C:/Users/Desktop/Geosill/attempt1.csv'))
lines = list(r)
lines[1][0] = 'ID'
lines[2][0] = 'sil_score'
writer = csv.writer(open('C:/Users/Desktop/Geosill/attempt3.csv', 'w'))
writer.writerows(lines)