December 2017
Intermediate to advanced
386 pages
10h 42m
English
The average of a distribution can be calculated by using the mean function within the numpy package. The way to extract the mean of the initialized distribution is as follows:
import numpy as np
np.mean(x,axis=0)
In the preceding line of code, we have calculated the mean of all the values within x. The output of the preceding line of code is as follows:
3.0372443687293549
The output is close to what we expected, as we have initialized the distribution with a mean of three.
The output does not match three exactly, as we have taken a smaller sample size. Let us calculate the mean of a normal distribution ...
Read now
Unlock full access