[Numpy-discussion] printing of array and leading white space ?

Friedrich Romstedt friedrichromstedt@gmail....
Sun Jun 27 16:33:34 CDT 2010


I don't know precisely how the decision is made, but in general one
needs the pad spaces for printing arrays with > 1 row.

Friedrich

2010/6/26 Vincent Davis <vincent@vincentdavis.net>:
> This is a little strange and I am not sure what is going on. Look at
> the number of spaced before the first number in the array.
>
>>>> x = np.array([629.54440098249688162, 26186.5470310494529258 ])
>>>> x
> array([   629.54440098249688162,  26186.5470310494529258 ])
>
> 3  spaces before 629.544...
>
>>>> x = np.array([629.54440098249688162, 2634186.5470310494529258 ])
>>>> x
> array([  6.29544400982496882e+02,   2.63418654703104962e+06])
>
> 2 spaces
>
> There are many different ways experiment, and I assume that the spaces
> are there to help the printed array look better. The 3 spaces are not
> there is the second digit is shorter. The thing is I can't think of an
> example where the 3 spaces are needed. Is there an example?
>
> Vincent


More information about the NumPy-Discussion mailing list