[FIX] OWSieve: Fix crash for attribute with no values#1934
Merged
janezd merged 2 commits intobiolab:masterfrom Jan 20, 2017
Merged
[FIX] OWSieve: Fix crash for attribute with no values#1934janezd merged 2 commits intobiolab:masterfrom
janezd merged 2 commits intobiolab:masterfrom
Conversation
lanzagar
requested changes
Jan 19, 2017
Orange/widgets/visualize/owsieve.py
Outdated
| 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: |
Contributor
There was a problem hiding this comment.
Unlike attr1, attr2 is again mapped through data.domain.
Also indentation?
Orange/widgets/visualize/owsieve.py
Outdated
| data.domain.index(attr1))[0], return_counts=True)[1] | ||
| self.probs_x = observed_x / self.n | ||
| self.observed = observed_x | ||
| if attr2.values: |
Contributor
There was a problem hiding this comment.
Would it be better to use elif to make it clearer only one of these ifs 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
|
janezd
reviewed
Jan 20, 2017
| 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) |
Contributor
There was a problem hiding this comment.
Could you use a normal if statement, not expression? I guess it would be so much easier to read. Refuse if you disagree.
astaric
pushed a commit
that referenced
this pull request
Feb 3, 2017
[FIX] OWSieve: Fix crash for attribute with no values (cherry picked from commit 022b5d7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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