Created
March 11, 2020 01:11
-
-
Save acharles7/0e403a17e541d28d38cdb82cb42b7542 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import numpy as np | |
import matplotlib.pyplot as plt | |
# generate random data and plot them | |
data = np.random.random_integers(10, 20, 100) | |
num, count = np.unique(data, return_counts=True) | |
plt.plot(num, count) | |
each_sample_size = 10 | |
sample_size = 500 | |
sample_average = [] | |
for i in range(sample_size): | |
sample_average.append(np.random.choice(data, each_sample_size).mean()) | |
# generate normal distributed plot | |
mean, mean_count = np.unique(sample_average, return_counts=True) | |
plt.plot(mean, mean_count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment