Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Lib/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@

from fractions import Fraction
from decimal import Decimal
from itertools import count, groupby, repeat
from itertools import compress, count, groupby, repeat
from bisect import bisect_left, bisect_right
from math import hypot, sqrt, fabs, exp, erfc, tau, log, fsum, sumprod
from math import isfinite, isinf, pi, cos, sin, tan, cosh, asin, atan, acos
Expand Down Expand Up @@ -195,9 +195,9 @@ def fmean(data, weights=None):
n = len(data)
except TypeError:
# Handle iterators that do not define __len__().
counter = count()
total = fsum(map(itemgetter(0), zip(data, counter)))
n = next(counter)
counter = count(1)
total = fsum(compress(data, counter))
n = next(counter) - 1
else:
total = fsum(data)

Expand Down
Loading