This short tutorial shows how you can calculate mean in Python using NumPy. First, we generate the random data with mean of 5 and standard deviation (SD) of 1. Then, you can use the numpy is mean() function. As you can see, the mean of the sample is close to 5.
import numpy as np # mean and standard deviation mu, sigma = 5, 1 y = np.random.normal(mu, sigma, 100) print(np.mean(y))
Regarding of how to generate random data with normal distribution, you can check my another post.