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

Vincent Davis vincent@vincentdavis....
Sat Jun 26 16:32:27 CDT 2010


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