**Introduction**

Chi-Squared Test of Independence determines the association between categorical variables. This means that it says whether the variables are related to each other or independent. It’s also called Chi-Square Test of Association.

The Chi-Squared Test uses a contingency table to determine the association. The contingency table contains the data which is classified according to the categorical features. The data of these categories are arranged in rows and columns. One of the categories has its data arranged in rows and the other has its arranged in columns. Each categorical column should have at least 2 or more categories.

To carry out the Chi-Squared Test, we need to meet the following requirements:

- We should use 2 categorical features.
- Each categorical feature should have 2 or more categories
- Independence of Observation
- There should be no relation between the subjects of each group.
- The categorical features should not be paired

- Should have a large sample size
- For each cell the expected frequency should be atleast 1.
- Expected frequency should be 5 for majority of cells.

Before getting into the coding part, let’s check the dataset and see what features it has:

**About the dataset**

The dataset is about consists of Placement data of MBA students of a B-school. It includes the following features:

- serial number (sl_no)
- gender(gender)
- secondary school percentage(ssc_p)
- secondary school specialization(ssc_b)
- higher secondary school percentage(hsc_p)
- higher secondary school specialization(hsc_b)
- degree percentage(degree_p)
- degree specialization(degree_t)
- workex(workex)
- competitive exam percentage(etest_p)
- Specialization(specialisation)
- mba percentage(mba_p)
- status(status)
- salary(salary)

You can download the dataset from kaggle https://www.kaggle.com/benroshan/factors-affecting-campus-placement?select=Placement_Data_Full_Class.csv

Also if you want to learn about hypothesis testing using T-test, the click here

**Reference:**

- https://www.kaggle.com/benroshan/factors-affecting-campus-placement?select=Placement_Data_Full_Class.csv
- https://en.wikipedia.org/wiki/Chi-squared_test
- https://github.com/krishnaik06/T-test-an-Correlation-using-python/blob/master/Hypothesis_Testing.ipynb
- https://www.youtube.com/watch?v=LE3AIyY_cn8
- https://www.youtube.com/watch?v=b3o_hjWKgQw&t=32s