Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

> 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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35892>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to