Skip to content

Instantly share code, notes, and snippets.

@wfaria
Created March 9, 2019 23:16
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/8f684b35d8cd4b12d2ccb4bc24095ebe to your computer and use it in GitHub Desktop.
Save wfaria/8f684b35d8cd4b12d2ccb4bc24095ebe to your computer and use it in GitHub Desktop.
Election Poll Simulation - Sample Histogram
fig, axes = plt.subplots(2,3, figsize = (12, 8))
fig.subplots_adjust(hspace=0.4, wspace=0.3)
axes = axes.ravel()
days = [5, 50, 500, 1000, 10000, 100000]
for i in range(len(days)):
sample_means = get_n_sample_means_from_distribution(
samples_number = days[i],
sample_size = 100)
axes[i].hist(sample_means, bins=30)
axes[i].set_title("{0} days".format(days[i]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment