File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -555,8 +555,9 @@ def mode(data):
555
555
556
556
"""
557
557
data = iter (data )
558
+ pairs = Counter (data ).most_common (1 )
558
559
try :
559
- return Counter ( data ). most_common ( 1 ) [0 ][0 ]
560
+ return pairs [0 ][0 ]
560
561
except IndexError :
561
562
raise StatisticsError ('no mode for empty data' ) from None
562
563
@@ -602,6 +603,7 @@ def multimode(data):
602
603
# mean=0.300. Only the latter (which corresponds with R6) gives the
603
604
# desired cut point with 30% of the population falling below that
604
605
# value, making it comparable to a result from an inv_cdf() function.
606
+ # The R6 exclusive method is also idempotent.
605
607
606
608
# For describing population data where the end points are known to
607
609
# be included in the data, the R7 inclusive method is a reasonable
You can’t perform that action at this time.
0 commit comments