Skip to content
Advertisement

Check result of chi square test on pandas columns data

I wrote the test according to an approach I found. When looking in Stack Overflow I saw another approach (can be seen here) which was a little more complicated, and made me wonder if I chose the right one.
I’m looking for ways to check if my calculation is correct.

Here is the relevant code:

JavaScript

Any suggestions will be welcomed. Thanks!

Advertisement

Answer

The other approach that you linked to is not actually a different method. The code in that question attempted to do the same calculations as those in chi2_contingency, but it had some mistakes.

Your code looks fine. With a p-value of 0.27, one would say that the data does not support rejecting the null hypothesis of no association between Eczema and Gender.

Advertisement