[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError
Terry J. Reedy
report at bugs.python.org
Fri Dec 16 19:22:30 EST 2016
Terry J. Reedy added the comment:
Srikanth, when you reply by email, please remove the quotation of the previous message. On the web page, it is just noise. The only exception should be when you reply to a specific sentence and need to quote that sentence for context.
In my particular experience, mode() is unusally reserved for crudely describing unordered categorical data, where the concept of 'minimum' does not apply.
Mode is useful for determining the winner of a vote (or other decision process), but in general, it is not a substitute for a more comprehensive look at a dataset.
Problems with possibly returning a tuple of data items instead of a data item include:
1. The user then has to be prepared to handle a tuple instead of a data item. It would be better then to always return a tuple, even for 1 item.
2. Data items can be tuples, making a tuple return ambiguous. Example use case: planar points with int coordinates.
>>> mode(((0,0), (0,0), (0,1)))
(0, 0)
So, while StatisticsError is a nuisance, so are the apparent alternatives. I think we should leave mode alone and close this.
----------
nosy: +terry.reedy
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28956>
_______________________________________
More information about the Python-bugs-list
mailing list