Hi! I am getting confused about the chi-squared test. I believe I did something wrong on my code and that is why my final answers ( chi_squared and p-value) are opposite to the solution answer. 10 Chi-squared I got are really close to each other, P-value I got is all 0.

I am not sure that I understand the logic of the code and the process of getting the chi-squared value. In the previous course, we learned that the chi-squared test for categorical data. This test enables us to determine the statistical significance of observing a set of categorical values. In this project, we try to determine if there is a significant relationship between terms_used and question value, but how does it help to answer ‘’ How often new questions are repeats of older questions?’’

Thank you.

Screen Link: https://app.dataquest.io/m/210/guided-project%3A-winning-jeopardy/1/jeopardy-questions

My Code:

```
from scipy.stats import chisquare
high_value_count=df[df['high_value']==1].size
low_value_count=df[df['high_value']==0].size
chi_squared=[]
for list in observed_expected:
total=high_value_count+low_value_count
total_prop=total/df.size
high_value_exp = total_prop * high_value_count
low_value_exp = total_prop * low_value_count
observed = np.array([list[0], list[1]])
expected = np.array([high_value_exp, low_value_exp])
chi_squared.append(chisquare(observed, expected))
chi_squared
```

What I expected to happen:

chi-squared values are different and p-value are different, like solution answers.

[Power_divergenceResult(statistic=11.176541727723734, pvalue=0.0008283803174322232),

Power_divergenceResult(statistic=66.4692943747559, pvalue=3.5538665717031723e-16),

Power_divergenceResult(statistic=100.02175882373152, pvalue=1.5073197124996154e-23),

Power_divergenceResult(statistic=376.61570111433804, pvalue=6.788672542236685e-84),

Power_divergenceResult(statistic=398.8157662485355, pvalue=9.970763066104784e-89),

Power_divergenceResult(statistic=55.47153614964141, pvalue=9.48221387660514e-14),

Power_divergenceResult(statistic=11.136321188780204, pvalue=0.000846536134458528),

Power_divergenceResult(statistic=11.176541727723734, pvalue=0.0008283803174322232),

Power_divergenceResult(statistic=132.9385887495118, pvalue=9.325221511674942e-31),

Power_divergenceResult(statistic=11.136321188780204, pvalue=0.000846536134458528)]

What actually happened:

```
[Power_divergenceResult(statistic=259985.00001341524, pvalue=0.0),
Power_divergenceResult(statistic=259985.00001341524, pvalue=0.0),
Power_divergenceResult(statistic=259985.00000539245, pvalue=0.0),
Power_divergenceResult(statistic=259985.00001341524, pvalue=0.0),
Power_divergenceResult(statistic=259985.00000539245, pvalue=0.0),
Power_divergenceResult(statistic=259985.00000539245, pvalue=0.0),
Power_divergenceResult(statistic=259985.00000539245, pvalue=0.0),
Power_divergenceResult(statistic=259981.00005905348, pvalue=0.0),
Power_divergenceResult(statistic=259983.00002156975, pvalue=0.0),
Power_divergenceResult(statistic=259973.00035695115, pvalue=0.0)]
```