I would like to format the DataFrame
| Col1 | Col2 | Col3 |
|---|---|---|
| -0.012 | 3.2 | nan |
| 0 | -1 | 15.2 |
| 0.5 | 7.53 | 76.88 |
using trailing zeros, such that all values in each column have the same number of digits. The result should look like this:
| Col1 | Col2 | Col3 |
|---|---|---|
| -0.012 | 3.20 | nan |
| 0.000 | -1.00 | 15.20 |
| 0.500 | 7.53 | 76.88 |
In the initial DataFrame, all values are strings
df['col1'] = df['col1'].map('${:,.3f}'.format)