Skip to content

Commit 5925b7d

Browse files
bpo-35892: Add usage note to mode() (GH-15122) (GH-15176)
(cherry picked from commit e43e7ed) Co-authored-by: Raymond Hettinger <[email protected]>
1 parent 84d31bb commit 5925b7d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/statistics.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,9 @@ However, for reading convenience, most of the examples show sorted sequences.
313313
measure of central location.
314314

315315
If there are multiple modes, returns the first one encountered in the *data*.
316-
If *data* is empty, :exc:`StatisticsError` is raised.
316+
If the smallest or largest of multiple modes is desired instead, use
317+
``min(multimode(data))`` or ``max(multimode(data))``. If the input *data* is
318+
empty, :exc:`StatisticsError` is raised.
317319

318320
``mode`` assumes discrete data, and returns a single value. This is the
319321
standard treatment of the mode as commonly taught in schools:

0 commit comments

Comments
 (0)