I was wondering if there was any particular reason as to why there doesn't exist a mode function like the mean and median functions that work on ndarray. I feel that it should be provided.
( On that note, if I wanted to contribute this function to numpy then what would be a good starting point for me?)
Thanks in advance
There's scipy.stats.mode which should do what you want. Mode is much less common than mean/median, so we won't move that into NumPy.
That doesn't make sense to me, since it is something that can be computed from functions already implemented in NumPy, and it's not nice to add Scipy as a dependency in a project just for a couple of methods not covered by NumPy. However, a workaround (at least for 1D arrays of ints) for this could be just np.argmax(np.bincount(array)) (extracted from https://stackoverflow.com/a/6252400).
Most helpful comment
That doesn't make sense to me, since it is something that can be computed from functions already implemented in NumPy, and it's not nice to add Scipy as a dependency in a project just for a couple of methods not covered by NumPy. However, a workaround (at least for 1D arrays of ints) for this could be just
np.argmax(np.bincount(array))(extracted from https://stackoverflow.com/a/6252400).