Arrange the results as a $2\times 2$-table and use `chi2_contigency` from SciPy in Python to obtain the correct $p$-value (here shown without continuity correction): import numpy as np from scipy.stats import chi2_contingency, fisher_exact obs = np.array([[8157, 8],[7906,10]]) g, p, dof, expctd = chi2_contingency(obs, correction = False) p 0.59094761107842753 So the $p$-value is roughly $0.5909$. A viable alternative would be to use Fisher's exact test. This can be done using `fisher_exact` from SciPy: oddsr, p_fish = fisher_exact(obs) oddsr 1.289685049329623 p_fish 0.64294290970149048 The odds ratio is $1.29$ with an associated $p$-value from Fisher's exact test of $0.643$.