bpo-35892: Add usage note to mode() (GH-15122) · python/cpython@e43e7ed (original) (raw)

Original file line number Diff line number Diff line change
@@ -313,7 +313,9 @@ However, for reading convenience, most of the examples show sorted sequences.
313 313 measure of central location.
314 314
315 315 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.
317 319
318 320 ``mode`` assumes discrete data, and returns a single value. This is the
319 321 standard treatment of the mode as commonly taught in schools: