[Numpy-discussion] setting decimal accuracy in array operations (scikits.timeseries)

Robert Kern robert.kern@gmail....
Wed Mar 3 14:33:41 CST 2010


On Wed, Mar 3, 2010 at 14:09, Marco Tuckner
<marcotuckner@public-files.de> wrote:
> Hello,
> am using the scikit.timeseries to convert a hourly timeseries to a lower
> frequency unsing the appropriate function [1].
>
> When I compare the result to the values calculated with a Pivot table in
> Excel there is a difference in the values which reaches quite high
> values in the total sum of all monthly values.
>
> I found out that the differnec arises from different decimal settings:
>
> In Python the numbers show:
> 12.88888888
>
> whereas in Excel I see:
> 12.8888888888888
>
> The difference due to the different decimals is small for single values
> and accumulates to a 2-digit number for the total of all values.
>
> * Why do these differences arise?
> * What can I do to achive comparable values?

We default to printing only eight decimal digits for floating point
values for convenience. There are more under the covers. Use
numpy.set_printoptions(precision=16) to see all of them.

If you are still seeing actual calculation differences, we will need
to see a complete, self-contained example that demonstrates the
difference.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list