swdata/fail_reason_chi2.py
2018-03-20 20:35:36 +08:00

6 lines
170 B
Python

from scipy.stats import chi2_contingency as chi2
import numpy as np
obs = np.array([[159,90],[53,24]])
chi,p,dof,expected = chi2(obs)
print("%f, %f, %f" % (chi, p, dof))