-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[FIX] OWSieve: Fix crash for attribute with no values #1934
Conversation
attr1 = data.domain[attr1] | ||
attr2 = data.domain[attr2] | ||
if attr1.is_discrete and not attr1.values or \ | ||
attr2.is_discrete and not data.domain[attr2].values: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike attr1
, attr2
is again mapped through data.domain
.
Also indentation?
data.domain.index(attr1))[0], return_counts=True)[1] | ||
self.probs_x = observed_x / self.n | ||
self.observed = observed_x | ||
if attr2.values: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use elif
to make it clearer only one of these if
s can get executed.
Current coverage is 89.30% (diff: 100%)@@ master #1934 diff @@
==========================================
Files 86 86
Lines 9120 9120
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 8145 8145
Misses 975 975
Partials 0 0
|
text_ = "Features {} and {} have no values".format(disc_x, disc_y) \ | ||
if not disc_x.values and not disc_y.values and \ | ||
disc_x != disc_y else "Feature {} has no values".format( | ||
disc_x if not disc_x.values else disc_y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use a normal if
statement, not expression? I guess it would be so much easier to read. Refuse if you disagree.
[FIX] OWSieve: Fix crash for attribute with no values (cherry picked from commit 022b5d7)
Issue
Fixes #1921
Description of changes
If any of chosen attributes has no values, show only another's values and a label "No data".
Includes