Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

scipy check normal distribution

from scipy import stats
pts = 1000
np.random.seed(28041990)
a = np.random.normal(0, 1, size=pts)
b = np.random.normal(2, 1, size=pts)
x = np.concatenate((a, b))

k2, p_value = stats.normaltest(x)

alpha = 1e-3
print("p_value = {:g}".format(p))
# p_value = 3.27207e-11

if p_value < alpha:  # null hypothesis: x comes from a normal distribution
  print("The null hypothesis can be rejected")
else:
  print("The null hypothesis cannot be rejected")
# The null hypothesis can be rejected
Comment

PREVIOUS NEXT
Code Example
Python :: mean along third dimension array python 
Python :: dbutils.widgets.get 
Python :: plotly coordinates mapping 
Python :: python random generator from list 
Python :: Link In Django 
Python :: size of set python 
Python :: get char from ascii value python 
Python :: how to make a username system using python 
Python :: get value from index python 
Python :: extract a jar py 
Python :: add a tuple to a dictionary python 
Python :: remove vowels in a string python 
Python :: read api from django 
Python :: Python program to find uncommon words from two Strings 
Python :: get the path of a module in python 
Python :: remove word from string in python 
Python :: get index of all element in list python 
Python :: isodate in python 
Python :: python change dictionary key 
Python :: python how to get the angle between two points by only their x,y 
Python :: django update field after save 
Python :: **kwargs in python 
Python :: how to comment text in python 
Python :: word counter python 
Python :: python find first occurrence in list 
Python :: python dataframe calculate difference between columns 
Python :: how to take space separated input in pyhon dicationary 
Python :: write python 
Python :: flask socketio usage 
Python :: replace character in string python by index 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =