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 Mosaic Display (owmosaic.py) #2014

Merged
merged 1 commit into from
Feb 14, 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/owmosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def set_data(self, data):
self.discrete_data = None
elif any(attr.is_continuous for attr in data.domain):
self.discrete_data = Discretize(
method=EqualFreq(n=4), discretize_classes=True,
method=EqualFreq(n=4), remove_const=False, discretize_classes=True,
discretize_metas=True)(data)
else:
self.discrete_data = self.data
Expand Down
8 changes: 8 additions & 0 deletions Orange/widgets/visualize/tests/test_owmosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ def test_missing_values(self):
data = Table(Domain(attrs, class_var), X, np.array([np.nan] * 6))
self.send_signal("Data", data)

def test_keyerror(self):
"""gh-2014
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)

# Derive from WidgetTest to simplify creation of the Mosaic widget, although
# we are actually testing the MosaicVizRank dialog and not the widget
Expand Down