1

I am trying to save some values from my training model as DataFrame which works okay but it only save a data for the first loop and it stops. I have tried to put it in a For loop but didn't help. What ways is available for me please to save for the whole training?

 df=pd.DataFrame({'Image_Name':names_preds, 'Target':targets.detach(), 'Prediction':preds.detach()})
            print(df)
            df.to_csv(r'test5.csv', index=False)
AA2018-2020
  • 341
  • 1
  • 6
  • 16

1 Answers1

0

Adding mode='a' sorted the issue.

df=pd.DataFrame({'Image_Name':names_preds, 'Target':targets.detach(), 'Prediction':preds.detach()})
            print(df)
            df.to_csv(r'test5.csv',mode='a', index=False)
AA2018-2020
  • 341
  • 1
  • 6
  • 16