I have to format a column of numbers in a data frame pandas rounding for two but with three decimal digits where the last is 0 and the column does not have to be a string. The numbers of this column must be represented so once exported to Excel.
d = {'col1': [0.567, 2.54765476], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
col1 col2
0 0.567 3
1 2.54765476 4
expected:
col1 col2
0 0.560 3
1 2.540 4
It is important that the type remain numerical