My code:
if __name__ == "__main__":
while True:
df = pd.read_csv('test - Sheet1 (6).csv')
for index, row in df.iterrows():
df['new']=preprocessing(row['prev'])
df.to_csv('today.csv',header=False)
I have some values in my CSV file like this in prev column-
prev
ABC
Abc
BaC
I have pre-processing function that will change the column something like this-
new
abc
abc
bac
But when I am writing it to CSV file, the output I am getting is -
| prev | new |
|---|---|
| ABC | bac |
| Abc | bac |
| BaC | bac |
it's only storing the last row value. How do I make it like this-
| prev | new |
|---|---|
| ABC | abc |
| Abc | abc |
| BaC | bac |