I'm creating a numpy array called a table, in the fifth column I want to save a list of numbers that I have in a .txt file
I do it with the following code:
tabla[:, 4] = np.fromfile('/home/lucia/Documentos/Base de datos de imagenes/TID2013/mos.txt', sep='\n')
in the file most.txt there is a list of 3000 numbers, one below the other, that is organized as a column, the numbers vary from 0 to 9 and have 5 decimal digits, the list looks something like this:
5.51429
5.56757
4.94444
4.37838
3.86486
.
.
.
Once I have my complete table (the other columns are not interesting now), I want to save it in a .csv file (comma separated values), I do it with the following code:
a=tabla.tolist()
with open('tabla.csv', 'w') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(headers)
writer.writerows(a)
The problem is that the numbers that have, the whole part other than 0, the last two decimal digits equal to 0 and the third other than 0 saves them without the point, so for example, to 3.92500 saves it as 3925 to 6.12500 saves it as 6125, that is, it seems that it takes the point as if they were thousands and not decimals ...
Does anyone have any idea why this happens and how can I solve it?