This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Windson Yang, francismb, rhettinger, steven.daprano
Date 2019-02-17.09:10:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550394634.55.0.212858769047.issue35892@roundup.psfhosted.org>
In-reply-to
Content
> Did I miss something?

Yes.  It doesn't really matter which mode is returned as long as it is deterministically chosen.  We're proposing to return the first mode rather than the smallest mode.  

Scipy returns the smallest mode because that is convenient given that the underlying operation is np.unique() which returns unique values in sorted order [1]. 

We want to return the first mode encountered because that is convenient given that the underlying operation is max() which returns the first maximum value it encounters.

Another advantage of return-first rather than return-smallest is that our mode() would work for data values that are hashable but not orderable (i.e. frozensets).

[1] https://github.com/scipy/scipy/blob/v0.19.1/scipy/stats/stats.py#L378-L443
History
Date User Action Args
2019-02-17 09:10:34rhettingersetrecipients: + rhettinger, steven.daprano, francismb, Windson Yang
2019-02-17 09:10:34rhettingersetmessageid: <1550394634.55.0.212858769047.issue35892@roundup.psfhosted.org>
2019-02-17 09:10:34rhettingerlinkissue35892 messages
2019-02-17 09:10:34rhettingercreate