I have a csv file with the data :
TableName , Rows , Columns , StartTime
DimAccount , 40 , 12 , 18.7
I need to append a new column to this CSV, such that the output is :
TableName , Rows , Columns , StartTime , EndTime
DimAccount , 40 , 12 , 18.7 , 20
I tried using :
fieldnames = ['EndTime']
with open(data.csv', 'a') as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writer.writerow({'EndTime': 20})
but it gives output as :
TableName , Rows , Columns , StartTime
DimAccount , 40 , 12 , 18.7
Endtime
20