I have the following list
alist = [0.141, 0.29, 0.585, 0.547, 0.233]
and I find the cumulative summation with
np.cumsum(alist)
array([ 0.141, 0.431, 1.016, 1.563, 1.796])
When I convert this array to a list, some decimal values show up. How can I avoid these decimals?
list(np.cumsum(alist))
[0.14099999999999999,
0.43099999999999994,
1.016,
1.5630000000000002,
1.7960000000000003]
This may be a duplicate, but I couldn't find the answer.