July 2017
Beginner to intermediate
420 pages
10h 56m
English
Finally, let's look at mode. We will just generate a bunch of random integers, 500 of them to be precise, that range between 18 and 90. We're going to create a bunch of fake ages for people.
ages = np.random.randint(18, high=90, size=500) ages
Your output will be random, but should look something like the following screenshot:

Now, SciPy, kind of like NumPy, is a bunch of like handy-dandy statistics functions, so we can import stats from SciPy using the following syntax. It's a little bit different than what we saw before.
from scipy import stats stats.mode(ages)
The code means, from the scipy
Read now
Unlock full access