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

[FIX] Handle KeyError Sieve Diagram widget (owsieve) when one row #2007

Merged
merged 1 commit into from
Feb 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Orange/widgets/visualize/owsieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def set_data(self, data):
self.domain_model.set_domain(data.domain)
if any(attr.is_continuous for attr in data.domain):
discretizer = Discretize(
method=EqualFreq(n=4),
method=EqualFreq(n=4),remove_const=False,
discretize_classes=True, discretize_metas=True)
self.discrete_data = discretizer(data)
else:
Expand Down
9 changes: 9 additions & 0 deletions Orange/widgets/visualize/tests/test_owsieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ def test_missing_values(self):
X = np.array([1, 2, 0, 1, 0, 2])[:, None]
data = Table(Domain(attrs, class_var), X, np.array([np.nan] * 6))
self.send_signal("Data", data)

def test_keyerror(self):
"""gh-2007
Check if it works when a table has only one row or duplicates.
Discretizer must have remove_const set to False.
"""
data = Table("iris")
data = data[0:1]
self.send_signal("Data", data)