from scipy import sum, mean, std, sqrt, absolute, array
import scipy.stats as st

k=array([83,91,122,107,74,123])
n=sum(k)
np=array([n/6]*6)
df=len(k)-1
alfa=0.05

chi2=sum( (k-np)**2 / np )
cf=st.chi2.ppf(1-alfa,df) # egyoldali! csak 1-alfa kell!
print(chi2,"?",cf)
