diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-09-21 04:46:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-21 04:46:52 (GMT) |
commit | 7ce4bfa8cfcc78d03e164f2de64a2caad1d919af (patch) | |
tree | 6415e46d93a245d7758d876ff57617471895fc95 /Lib/statistics.py | |
parent | 87d6cd3604e5c83c06339276228139f5e040b0e7 (diff) | |
download | cpython-7ce4bfa8cfcc78d03e164f2de64a2caad1d919af.zip cpython-7ce4bfa8cfcc78d03e164f2de64a2caad1d919af.tar.gz cpython-7ce4bfa8cfcc78d03e164f2de64a2caad1d919af.tar.bz2 |
Minor code and comment cleanup (GH-16315)
Diffstat (limited to 'Lib/statistics.py')
-rw-r--r-- | Lib/statistics.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/statistics.py b/Lib/statistics.py index d81596e..0d747b3 100644 --- a/Lib/statistics.py +++ b/Lib/statistics.py @@ -555,8 +555,9 @@ def mode(data): """ data = iter(data) + pairs = Counter(data).most_common(1) try: - return Counter(data).most_common(1)[0][0] + return pairs[0][0] except IndexError: raise StatisticsError('no mode for empty data') from None @@ -602,6 +603,7 @@ def multimode(data): # mean=0.300. Only the latter (which corresponds with R6) gives the # desired cut point with 30% of the population falling below that # value, making it comparable to a result from an inv_cdf() function. +# The R6 exclusive method is also idempotent. # For describing population data where the end points are known to # be included in the data, the R7 inclusive method is a reasonable |