Skip to content

Instantly share code, notes, and snippets.

@wfaria
Last active March 10, 2019 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wfaria/8ba4f38cc603370f778f3bf1aed0e3ae to your computer and use it in GitHub Desktop.
Save wfaria/8ba4f38cc603370f778f3bf1aed0e3ae to your computer and use it in GitHub Desktop.
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)
print(sample_means)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment