简体   繁体   中英

How to address the issue of inconsistent values in a numpy array?

In a recent project I have been dealing with numpy arrays. At first I make the array by simply giving start and end point and the stepsize. At a later instance, I need to call a single value from the array but the value of that was saved in the array and the value that the array retrieves are not the same.

I need and want both of the values in the output to be same. I have attached the screen shotso more clarity enter image description here

use np.set_printoptions() to change the way the array is printed. The value is apparently correct, it's correct when you print it by index, it's just not being printed the way you want it to when you print the entire array.

https://numpy.org/doc/stable/reference/generated/numpy.set_printoptions.html

np.set_printoptions(precision=16) should work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM