I\'m trying to print a ndarray on the screen. But python always shows it in scientific notation, which I don\'t like. For a scalar we can use
>>> p
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.