scipy.stats.chisquare is not working
See original GitHub issueMy issue is about … scipy.stats.chisquare is not working since last update
Reproducing code example:
obs_spec=pd.read_fwf(folder+'obs.txt',header=None)
the_spec=pd.read_fwf(folder+'models/m9.dat',header=None)
sps.chisquare(f_obs=obs_spec[1], f_exp=the_spec[1])
Sample code to reproduce the problem
Error message:
Traceback (most recent call last):
ValueError Traceback (most recent call last)
<ipython-input-28-726f4043508e> in <module>
14 obs_spec,the_spec
15
---> 16 a=sps.chisquare(f_obs=obs_spec[1], f_exp=the_spec[1])
17 a
~/anaconda3/lib/python3.7/site-packages/scipy/stats/stats.py in chisquare(f_obs, f_exp, ddof, axis)
6851 """
6852 return power_divergence(f_obs, f_exp=f_exp, ddof=ddof, axis=axis,
-> 6853 lambda_="pearson")
6854
6855
~/anaconda3/lib/python3.7/site-packages/scipy/stats/stats.py in power_divergence(f_obs, f_exp, ddof, axis, lambda_)
6692 f"of {rtol}, but the percent differences are:\n"
6693 f"{relative_diff}")
-> 6694 raise ValueError(msg)
6695
6696 else:
ValueError: For each axis slice, the sum of the observed frequencies must agree with the sum of the expected frequencies to a relative tolerance of 1e-08, but the percent differences are:
0.19829509324291156
File "<stdin>", line 1, in <module>
...
Scipy/Numpy/Python version information:
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
scipy.stats.chisquare — SciPy v1.9.3 Manual
Calculate a one-way chi-square test. The chi-square test tests the null hypothesis that the categorical data has the given frequencies. ... This test...
Read more >Chisquare statistic not working python - Cross Validated
When I try to calculate the Chisquare statistic I get a value of roughly 2000, and a p-value of 0. My code for...
Read more >understanding scipy.stats.chisquare - Stack Overflow
In this case, the null hypothesis is that there is no association among the categories. A large discrepancy of the frequencies from the...
Read more >Chi-square - Python for Data Science - WordPress.com
Chi-square test of independence assumptions; Data used in this example; Chi-square using scipy.stats.chi2_contingency; Chi-square pot-hoc testing ...
Read more >How to use the Chi-Square Test in Python Scipy - YouTube
In this Python Scipy tutorial, we will discuss "What is Chi-Square Test" and how to use this test to know the association between ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yup, and that’s why we added the check : ) Thanks!
You are welcome to use the old code. This was the relevant code in 87641e3.