I have a np array freq_vector filled with floating numbers. For example freq_vector[0][0] is 200.00000000000003
I want to limit it to 4 decimals, then convert it to string for other usage.
When I do round(freq_vector[0][0], 4), the result is 200.0, rather than 200.0000
How can I get 200.0000?
200.0is the proper result of the rounding. You will only get200.0000if you use string formatters such as'{0:.4f}'.format(200.00000000000003).np.array2string(np.array(12.), precision=4, floatmode='fixed'), or equivalent withnp.set_printoptions.