[SciPy-user] output formatting of scipy arrays

Andrew Jaffe a.h.jaffe at gmail.com
Mon Dec 26 04:21:39 CST 2005


Travis-

Travis Oliphant wrote:
> Andrew Jaffe wrote:
>>
>>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)
> 

Exactly what I was looking for. Brilliant...

OK, you've convinced me to buy the book.

Happy Hannukah, Christmas, Kwanzaa, etc!

A



More information about the SciPy-user mailing list