Thursday, August 2, 2012

Setting numpy (pylab) printing options

Numpy (and pylab which uses numpy) can be instructed to change how it prints out arrays and other objects. The one I find most useful is:

pylab.set_printoptions(threshold=5)

If there are more than threshold elements in an array then pylab/numpy will use the ... (elipses) notation to print, which reduces clutter.

No comments:

Post a Comment