with code from http://rpubs.com/newajay/chisquaretest
In [11]:
from scipy.stats import chi2_contingency
import numpy as np
In [13]:
obs = np.array([[7, 87, 12,9], [4, 102, 7,8]])
In [15]:
chi2, p, dof, expected = chi2_contingency(obs)
In [16]:
print (p)
In [17]:
print (chi2)
In [18]:
print (dof)
In [19]:
print (expected)
In [ ]: