I have a pandas dataframe, with columns [QuantityReq] as Float and [Test] as Float. I am trying to get 3 digits after the decimal points. The [Test] column which I create is truncating for 3 digits after decimal, but in some cases it is rounding at the 3rd digit. I have highlighted the error in row 2 and 3 of [Test] column where it is showing 0.869 instead of 0.87 and 59.306 instead of 59.307
Any help is greatly appreciated.
df['Test'] = np.trunc( df['QuantityReq']* 1000)/1000