How to Find Number That Appears Most Often in Some Numbers in Python


In this example we will show how to find the number that appears most often in some Numbers using the SciPy mode() method in Python.

Source Code

from scipy import stats

num = [15, 20, 15, 32, 20, 28, 15, 22]

mode_num = stats.mode(num)

print(mode_num)

Output:

ModeResult(mode=array([15]), count=array([3]))
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments