Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created November 9, 2020 10:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save yuyasugano/26eb91b80ceeae3d7ef1b7b5a775c235 to your computer and use it in GitHub Desktop.
3 ways to do test of normality with Scipy library in Python
from scipy import stats
c = stats.shapiro(a)
d = stats.shapiro(b)
print('W statistic is {0} and p-value is {1}'.format(c[0], c[1]))
W statistic is 0.998044490814209 and p-value is 0.301758736371994
# can't reject the null hypothesis, it is likely normally distributed
print('W statistic is {0} and p-value is {1}'.format(d[0], d[1]))
W statistic is 0.9490579962730408 and p-value is 4.253243595739461e-18
# can reject the null hypothesis, this should not be the normal distribution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment