Nice catch Andre!!! np.set_printoptions(suppress=True) solved it. Thanks!!!
Message: 4 Date: Wed, 18 Oct 2017 20:31:54 +0200 From: Andras Deak <[email protected]> To: Discussion of Numerical Python <[email protected]> Subject: Re: [Numpy-discussion] different values for ndarray when printed with or without Message-ID: <camewa4pwbx611gawojqc8heu2nss3-ugaajhamwocqtnfti...@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" On Wed, Oct 18, 2017 at 7:30 PM, Nissim Derdiger <[email protected]> wrote: > 3. difference between values are: > [ 2.25699615e+02 5.51561475e-01 3.81394744e+00 1.03807904e-01] > Instead of: > [225.69961547851562, 0.5515614748001099, 3.8139474391937256, > 0.10380790382623672] The behaviour you're describing sounds like a matter of pretty-printing. Numpy uses a shortened format for printing numeric values by default. When you convert to a list, you leave numpy behind and you get the native python behaviour. If you want to control how this pretty-printing happens in numpy, take a close look at numpy.set_printoptions: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.set_printoptions.html . Now, I still don't see how taking a trivial view of your array would affect this printing, but I believe your values themselves are identical (i.e. correct) in both cases, and they are only displayed differently. If you were to do further computations with your arrays, the results would be the same. Regards, Andr?s ------------------------------ Subject: Digest Footer _______________________________________________ NumPy-Discussion mailing list [email protected] https://mail.python.org/mailman/listinfo/numpy-discussion ------------------------------ End of NumPy-Discussion Digest, Vol 133, Issue 14 ************************************************* _______________________________________________ NumPy-Discussion mailing list [email protected] https://mail.python.org/mailman/listinfo/numpy-discussion
