Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created November 7, 2020 06:14
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 yuyasugano/267bc7be9f954f48f4e9e78dcbdaa3bd to your computer and use it in GitHub Desktop.
Save yuyasugano/267bc7be9f954f48f4e9e78dcbdaa3bd to your computer and use it in GitHub Desktop.
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