Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Election Poll Simulation - Getting multiple samples
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.