Home > Mobile >  Writing to csv makes column without being written
Writing to csv makes column without being written

Time:09-17

I am trying to do math on a specific cell in a csv file with pandas, but whenever I try to do it, it adds a column on the left that looks like

, 
1,value,value
2,value,value
3,value,value
4,value,value
5,value,value

So if I run it multiple times it looks like

,
1,1,1,value,value
2,2,2,value,value
3,3,3,value,value
4,4,4,value,value
5,5,5,value,value

How do I make it not do this??

My code is: add_e_trial = equations_reader.at[bank_indexer_addbalance, 1] = reciever_amount

CodePudding user response:

Whenever you do a df.to_csv, include index=False. The left most column is the index of the dataset

df.to_csv(index=False)
  • Related