<分区>
这是一个非常简单的问题,但我不知道用正确的词来谷歌。我有一个 numpy 数组:
A = np.array([ 8.1588e-01, -3.9675e-04])
我想把它打印成普通的十进制数字。即 0.81588, -0.00039675
。
你怎么做到的?
<分区>
这是一个非常简单的问题,但我不知道用正确的词来谷歌。我有一个 numpy 数组:
A = np.array([ 8.1588e-01, -3.9675e-04])
我想把它打印成普通的十进制数字。即 0.81588, -0.00039675
。
你怎么做到的?
最佳答案
Numpy 让您可以使用 set_printoptions
全局自定义输出.
要摆脱科学记数法,您可以使用:
np.set_printoptions(suppress=True) # don't use scientific notation
来自文档:
suppress : bool, optional
If True, always print floating point numbers using fixed point notation, in which case numbers equal to zero in the current precision will print as zero. If False, then scientific notation is used when absolute value of the smallest number is < 1e-4 or the ratio of the maximum absolute value to the minimum is > 1e3. The default is False.
关于python - 如何让 numpy 不以科学记数法打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50771966/