Skip to content Skip to sidebar Skip to footer

How To Force A Ndarray Show In Normal Way Instead Of Scientific Notation?

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 >>> print '%2.4f' %(7.47212470

Solution 1:

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]

Post a Comment for "How To Force A Ndarray Show In Normal Way Instead Of Scientific Notation?"