Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
3 ways to do test of normality with Scipy library in Python
import numpy as np
import matplotlib.pyplot as plt
# https://docs.scipy.org/doc/numpy-1.15.0/reference/routines.random.html
a = np.random.randn(1000) # conforms to the normal distribution
b = np.random.rand(1000) # random values in 0 to 1
fig = plt.figure(figsize=(10, 5))
ax1 = fig.add_subplot(1, 2, 1)
ax2 = fig.add_subplot(1, 2, 2)
ax1.hist(a, bins=100)
ax2.hist(b, bins=100)
fig.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment