July 2017
Beginner to intermediate
420 pages
10h 56m
English
We can also visualize probability mass functions. This is called the binomial probability mass function. Again, we are going to use the same syntax as before, as shown in the following code:
from scipy.stats import expon import matplotlib.pyplot as plt x = np.arange(0, 10, 0.001) plt.plot(x, expon.pdf(x))
So instead of expon or norm, we just use binom. A reminder: The probability mass function deals with discrete data. We have been all along, really, it's just how you think about it.
Coming back to our code, we're creating some discrete x values between 0 and 10 at a spacing of 0.01, and we're saying I want to plot a binomial probability mass function using that data. With the binom.pmf function, I can ...
Read now
Unlock full access