I have a dataframe which have float numbers and I would like to save it with the same number of digits.
This is my dataframe df
:
1 0.917007 0.920562 0.922801 0.922745 0.917396 0.922445
2 0.914374 0.926690 0.914257 0.914607 0.914462 0.910307
3 0.919565 0.907405 0.916554 0.916463 0.919817 0.917184
4 0.912238 0.915469 0.900786 0.900752 0.912059 0.919894
5 0.906972 0.920995 0.918015 0.918200 0.908895 0.907092
And I am saving it doing:
from pandas import ExcelWriter
writer = ExcelWriter('PythonExport.xlsx')
table.to_excel(writer,'aName',float_format='%11.4f')
writer.save()
But when I open the file, I see this:
How can I do to force the number of digits saved for each cell to get this?:
Edit: same happening trying to save as a csv file with the following
table.to_csv('PythonExport.csv', sep=',',float_format='%11.4f')
Note: I'm using python3