-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Z score returns DivisionByZeroError when N = 0. #40
Comments
Hi @ditlevjoergensen, |
Thank you @milcent for your swift response! I will look into using the bf.first_digits() functions. |
Hi again @milcent, I found that setting input parameters KS=True, and chi_squared=True didn't work. However it didn't matter as i simply imported the functions directly from stats and used them manually on the result. The functions only returned [['Counts', 'Found', 'Expected', 'Z_score']]. Thank you for helping me in the right direction, i will close the issue. regards Ditlev. |
Dear @ditlevjoergensen , |
I have inserted a fix in an internal functional, so the Z-score won't receive N=0 |
Hello. I hope this is the correct way to report issues I have run into using your program.
When i try using the Benford on a dataset containing only single integers it returns DivisionByZero error when calculating F2D/F3D/SD/L2D simply because the Base() class which transforms data places -1 for all values. Thus giving N = 0.
To bypass this I have simply made my test data contain values > 1000. However, I cant manipulate produktion data. As of today, there is no issues as every data-set i test Benford() on luckily contain at least 1 data point with a value > 1000.
I don't like having to specifically TRY/CATCH each time i use Benford, simply because it calculates for all digits, ie. F1D, F2D, F3D, SD, L2D.
I think there should be an input to Benford() stating which digits to test against?
`def Z_score(frame, N):
"""Computes the Z statistics for the proportions studied
E ZeroDivisionError: division by zero`
Hope this makes sence, there is nothing wrong with the Z_score function. The issue is how Benford() tries to test against fx. F3D even if there is no 3 digit number in the data set.
The text was updated successfully, but these errors were encountered: