2 ms·
There's also fmean() which is for floats: >>> data = (1_000_000_000.1, 1.1) * 50_000 >>> statistics.fmean(data) 500000000.6 Implementation at https://gi
by eesmith 5y ago
There's also fmean() which is for floats:
>>> data = (1_000_000_000.1, 1.1) * 50_000
>>> statistics.fmean(data)
500000000.6
Implementation at https://github.com/python/cpython/blob/6df926f1c46eb6db7b5dcd0227c6b532c78525c9/Modules/mathmodule.c#L1314 https://github.com/python/cpython/blob/6df926f1c46eb6db7b5dc... .
- eesmith 5y agoI just found that boltons supports a mean, in boltons.statsutils.mean . It appears to use the naive summation: >>> import boltons.statsutils >>> data = (1_000_000_000.1, 1.1) * 50_000 >>> boltons.statsutils.mean(data) 500000000.60091573 >>> sum(data) / len(data) 500000000.60091573