I am trying to add a new line to the data in a csv file. While data is being added, instead of being inserted into the next line, it is added to the end of the previous line. Currently, my problem code is as follows:
qlist = list(data)
entries = [response, 0,0,0,0]
df = pd.DataFrame([entries], columns=qlist)
df.to_csv('data.csv', index=False, header=False, mode='a')
When this is done, the 'response' variable ends at the same place as the last data value of the last row. How to add entries to a new line?
source
share