From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 8 Aug 2019 08:36:55 +0000 (-0700) Subject: bpo-35892: Add usage note to mode() (GH-15122) (GH-15176) X-Git-Tag: v3.8.0b4~119 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5925b7d555bc36bd43ee8704ae75cc51900cf2d4;p=python bpo-35892: Add usage note to mode() (GH-15122) (GH-15176) (cherry picked from commit e43e7ed36480190083740fd75e2b9cdca72f1a68) Co-authored-by: Raymond Hettinger --- diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst index a906a591e6..1a19e37419 100644 --- a/Doc/library/statistics.rst +++ b/Doc/library/statistics.rst @@ -313,7 +313,9 @@ However, for reading convenience, most of the examples show sorted sequences. measure of central location. If there are multiple modes, returns the first one encountered in the *data*. - If *data* is empty, :exc:`StatisticsError` is raised. + If the smallest or largest of multiple modes is desired instead, use + ``min(multimode(data))`` or ``max(multimode(data))``. If the input *data* is + empty, :exc:`StatisticsError` is raised. ``mode`` assumes discrete data, and returns a single value. This is the standard treatment of the mode as commonly taught in schools: