How can we update only the decimal values of the column with trailing zeros if there are only one digit after decimal.
Example dataframe:
df = pd.DataFrame(data=[[0.3, 0.3], [0.5, 1], [0.400, 0.4], [0.2, 5],[1.2, 1.55]],
columns=['credit', 'min_credit'])
Executing the below code changes the int as well
df[min_required_credit] = df[min_credit].map('{:.2f}'.format)
Expected result:
| credit | min_credit |
|---|---|
| 0.3 | 0.30 |
| 0.5 | 1 |
| 0.400 | 0.40 |
| 0.2 | 5 |
| 1.2 | 1.55 |