How to force a ndarray show in normal way instead of scientific notation?

吃可爱长大的小学妹 提交于 2019-12-01 06:39:27

The numpy.set_string_function function can be used to change the string representation of arrays.

You can also use numpy.set_print_options to change the precision used by default and turn off reporting of small numbers in scientific notation.

From the examples for set_print_options:

>>> np.set_printoptions(precision=4)
>>> print np.array([1.123456789])
[ 1.1235]

I don't know about the numpy arrays but I was simply facing the same problem while doing a project in Python.

Take a look at the Decimal class provided http://docs.python.org/library/decimal.html .

I don't know if it's provided in numpy though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!