How to pretty-print a numpy.array without scientific notation and with given precision?
Asked 07 September, 2021
Viewed 1.8K times
  • 53
Votes

I'm curious, whether there is any way to print formatted numpy.arrays, e.g., in a way similar to this:

x = 1.23456
print '%.3f' % x

If I want to print the numpy.array of floats, it prints several decimals, often in 'scientific' format, which is rather hard to read even for low-dimensional arrays. However, numpy.array apparently has to be printed as a string, i.e., with %s. Is there a solution for this?

14 Answer