I try to write my data to a csv file multiple times, and each time on a new column.
The code I used as follow:
for i in range(2):
loss = np.array([np.random.rand(10) + i, ])
df = pd.DataFrame(loss.T)
df.to_csv('res.csv', index=False, mode='a')
However, it did not write on a new column the second time, but under the columns of the first time.
What can I do to make it write to a new column?