[SciPy-user] output formatting of scipy arrays

Travis Oliphant oliphant.travis at ieee.org
Sun Dec 25 01:29:18 EST 2005


Andrew Jaffe wrote:

>Hi all-
>
>Sorry as usual if this is a faq, but is there any easy way to change the 
>way arrays appear when printed (presumably, this means affecting the 
>behavior of __str__?).
>
>Currently, I get things like
>
>[[ 1.          0.71375029  0.01215192 -0.90644004  0.02740346  0.66145675
>    0.85629017  0.96413003  0.65755463]
>  [...
>
>when what I'd really prefer is something like
>
>[[ 1.     0.714  0.012 -0.906  0.027  0.661  0.856  0.964  0.658]
>  [...
>
>Specifically, I'd like to get
>   - less wide floating-point numbers
>  
>
>   - more entries per line
>  
>

Try:

scipy.set_printoptions(precision=4, linewidth=100)

-Travis






More information about the SciPy-User mailing list