I have a pandas DataFrame with decimal values, say as follows:
import pandas as pd
df = pd.DataFrame({'a':[0.001234, 0.003986, 0.12], 'b':['aa', 'bb', 'cc']})
I need to limit the number of decimal digits of 'a' column to 5, without rounding. So the result should be :
result = pd.DataFrame({'a':[0.00123, 0.00398, 0.12], 'b':['aa', 'bb', 'cc']})
(zeros can be added at the end of 0.12, this is not a problem).
How can I do this? I have tried
df['a'] = df['a'].round(decimals=5)
but of course, as expected, it does not do the trick.
Thanks in advance,
M