[Numpy-discussion] bug in numpy.mean() ?

eat e.antero.tammi at gmail.com
Tue Jan 24 18:12:06 EST 2012


Hi,

Oddly, but numpy 1.6 seems to behave more consistent manner:

In []: sys.version
Out[]: '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]'
In []: np.version.version
Out[]: '1.6.0'

In []: d= np.load('data.npy')
In []: d.dtype
Out[]: dtype('float32')

In []: d.mean()
Out[]: 3045.7471999999998
In []: d.mean(dtype= np.float32)
Out[]: 3045.7471999999998
In []: d.mean(dtype= np.float64)
Out[]: 3045.747251076416
In []: (d- d.min()).mean()+ d.min()
Out[]: 3045.7472508750002
In []: d.mean(axis= 0).mean()
Out[]: 3045.7472499999999
In []: d.mean(axis= 1).mean()
Out[]: 3045.7472499999999

Or does the results of calculations depend more on the platform?


My 2 cents,
eat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120125/912a52b8/attachment.html>


More information about the NumPy-Discussion mailing list