Last active
March 10, 2019 00:59
-
-
Save wfaria/8ba4f38cc603370f778f3bf1aed0e3ae to your computer and use it in GitHub Desktop.
Election Poll Simulation - Getting multiple samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_n_samples_from_distribution(samples_number, sample_size): | |
""" | |
Get multiple samples from our target 'unknown distribution'. | |
""" | |
people_per_day = [sample_size] * samples_number | |
week_samples = list(map(get_sample_from_distribution, people_per_day)) | |
return week_samples | |
def get_n_sample_means_from_distribution(samples_number, sample_size): | |
samples = get_n_samples_from_distribution( | |
samples_number = samples_number, | |
sample_size = sample_size) | |
return list(map(np.mean, samples)) | |
sample_means = get_n_sample_means_from_distribution(5, 100) | |
print(sample_means) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment