Skip to content
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

Test fails - division by zero #2

Open
tomron opened this issue Dec 29, 2017 · 0 comments
Open

Test fails - division by zero #2

tomron opened this issue Dec 29, 2017 · 0 comments

Comments

@tomron
Copy link

tomron commented Dec 29, 2017

I run the test as described in the read me and I get the following error -

======================================================================
ERROR: test_cronbach_alphas (test.StatsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/tomron/code/processRat/tci-stats/test/__init__.py", line 9, in test_cronbach_alphas
    self.assertEqual(cronbach_alpha(data), 1)
  File "/Users/tomron/code/processRat/tci-stats/tcistats/__init__.py", line 11, in cronbach_alpha
    (1 - variance_sum / total_var))
ZeroDivisionError: float division by zero
----------------------------------------------------------------------

It has to do with total_variance=0. So the solution might be -

if total_variance == 0:
    return 1
return ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant