For categorical data.
To compare two or more categorical datasets.
from scipy.stats import chi2_contingency
The input to chi2_contingency is a contingency table where:
- The columns represent different outcomes, like "Survey Response A" vs. "Survey Response B" or "Clicked a Link" vs. "Didn't Click"
- The rows are each a different condition, such as men vs. women or Interface A vs. Interface B
X = [[30, 10],
[35, 5],
[28, 12],
[20, 20]]
_, pval, _, _ = chi2_contingency(X)