[英]How to address the issue of inconsistent values in a numpy array?
In a recent project I have been dealing with numpy arrays.在最近的一个项目中,我一直在处理 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.我需要并希望 output 中的两个值相同。 I have attached the screen shotso more clarity enter image description here我已附上屏幕截图,以便更清晰在此处输入图像描述
use np.set_printoptions()
to change the way the array is printed.使用np.set_printoptions()
更改数组的打印方式。 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 https://numpy.org/doc/stable/reference/generated/numpy.set_printoptions.html
np.set_printoptions(precision=16)
should work for you. np.set_printoptions(precision=16)
应该适合你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.