I want to export numpy arrays as csv files but I may have files with the same names in my folder. So, I want to replace old files with new ones. I am using the following method:
arr=np.array([[1., 2.], [2., 1.]])
np.savetxt('arr.csv', arr, delimiter=',')
But this method overwrites rows of the existing arr.csv file in my folder. Is there a way to completely replace the old file?
I do appreciate any help in advance.
10rows. Then new one may have only8rows. this method will rewrite the first8rows of old one and two last rows will remain there. I I could replace the file, then the problem of that two extra rows will be solved.