How do I print a numpy array?

Beliavsky beliavsky at aol.com
Fri Dec 1 18:50:00 EST 2006


Robert Kern wrote:
> Grant Edwards wrote:
> > How do you print a numpy array?
> >
> > I tried the obvious print a, print `a`, and print str(a), but
> > none of them work on anything other than trivially small
> > arrays.  Most of my real data is elided and replaced with
> > ellipses.
>
> You might want to ask numpy questions on the numpy list:
>
>   http://www.scipy.org/Mailing_Lists
>
> Use numpy.set_printoptions(threshold=sys.maxint) to disable all summarization.

When I print an array in any language, I (and I think most programmers)
expect by default to have all elements displayed. Matlab, R, and
Fortran 95 have somewhat similar arrays to numpy, and that is what they
do. I don't remember Numeric summarizing arrays by default. R has a
"summary" function as well as a "print" function.




More information about the Python-list mailing list