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):
555555
556556 """
557557 data = iter (data )
558+ pairs = Counter (data ).most_common (1 )
558559 try :
559- return Counter ( data ). most_common ( 1 ) [0 ][0 ]
560+ return pairs [0 ][0 ]
560561 except IndexError :
561562 raise StatisticsError ('no mode for empty data' ) from None
562563
@@ -602,6 +603,7 @@ def multimode(data):
602603# mean=0.300. Only the latter (which corresponds with R6) gives the
603604# desired cut point with 30% of the population falling below that
604605# value, making it comparable to a result from an inv_cdf() function.
606+ # The R6 exclusive method is also idempotent.
605607
606608# For describing population data where the end points are known to
607609# be included in the data, the R7 inclusive method is a reasonable
You can’t perform that action at this time.
0 commit comments