Repository: biolab/orange3

Issue:
Visualize - Parallel Coordinates fails for Iris dataset
When trying to use widget Parallel Coordianates on Iris dataset (as can be done in Orange2.7), visualization fails with given output:

---

TypeError                                     Traceback (most recent call last):
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/canvas/scheme/widgetsscheme.py", line 687, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 203, in handleNewSignals
    self.update_graph()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 144, in update_graph
    self.graph.update_data(self.shown_attributes)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 115, in update_data
    self.draw_curves()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 185, in draw_curves
    selected_curves[color].extend(scale_row(row))
## TypeError: unhashable type: 'numpy.ndarray'

TypeError                                     Traceback (most recent call last):
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/canvas/scheme/widgetsscheme.py", line 687, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 203, in handleNewSignals
    self.update_graph()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 144, in update_graph
    self.graph.update_data(self.shown_attributes)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 115, in update_data
    self.draw_curves()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 185, in draw_curves
    selected_curves[color].extend(scale_row(row))
## TypeError: unhashable type: 'numpy.ndarray'

TypeError                                     Traceback (most recent call last):
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/canvas/scheme/widgetsscheme.py", line 687, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 203, in handleNewSignals
    self.update_graph()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 144, in update_graph
    self.graph.update_data(self.shown_attributes)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 115, in update_data
    self.draw_curves()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 185, in draw_curves
    selected_curves[color].extend(scale_row(row))
## TypeError: unhashable type: 'numpy.ndarray'

TypeError                                     Traceback (most recent call last):
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/canvas/scheme/widgetsscheme.py", line 687, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 203, in handleNewSignals
    self.update_graph()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 144, in update_graph
    self.graph.update_data(self.shown_attributes)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 115, in update_data
    self.draw_curves()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 185, in draw_curves
    selected_curves[color].extend(scale_row(row))
## TypeError: unhashable type: 'numpy.ndarray'

AttributeError                                Traceback (most recent call last):
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/gui.py", line 2534, in **call**
    self.f(**kwds)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 144, in update_graph
    self.graph.update_data(self.shown_attributes)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 88, in update_data
    if not (self.have_data or self.have_subset_data):
## AttributeError: 'OWParallelGraph' object has no attribute 'have_subset_data'

AttributeError                                Traceback (most recent call last):
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/canvas/scheme/widgetsscheme.py", line 687, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 203, in handleNewSignals
    self.update_graph()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 144, in update_graph
    self.graph.update_data(self.shown_attributes)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 88, in update_data
    if not (self.have_data or self.have_subset_data):
## AttributeError: 'OWParallelGraph' object has no attribute 'have_subset_data'

TypeError                                     Traceback (most recent call last):
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/canvas/scheme/widgetsscheme.py", line 687, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 203, in handleNewSignals
    self.update_graph()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelcoordinates.py", line 144, in update_graph
    self.graph.update_data(self.shown_attributes)
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 115, in update_data
    self.draw_curves()
  File "/Applications/Orange3.app/Contents/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Orange/widgets/visualize/owparallelgraph.py", line 185, in draw_curves
    selected_curves[color].extend(scale_row(row))
TypeError: unhashable type: 'numpy.ndarray'



Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owparallelgraph.py b/Orange/widgets/visualize/owparallelgraph.py
--- a/Orange/widgets/visualize/owparallelgraph.py
+++ b/Orange/widgets/visualize/owparallelgraph.py
@@ -85,7 +85,7 @@ def update_data(self, attributes, mid_labels=None):
 
         self.clear()
 
-        if not (self.have_data or self.have_subset_data):
+        if not (self.have_data):
             return
         if len(attributes) < 2:
             return
@@ -178,7 +178,7 @@ def scale_row(row):
             if any(np.isnan(v) for v in row.x):
                 continue
 
-            color = self.select_color(row_idx)
+            color = tuple(self.select_color(row_idx))
 
             if is_selected(row):
                 color += (self.alpha_value,)
@@ -235,7 +235,7 @@ def draw_groups(self):
                 nsigma2 = math.sqrt(sigma2) / diff[i + 1]
 
                 polygon = ParallelCoordinatePolygon(i, nmu1, nmu2, nsigma1, nsigma2, phi,
-                                                    self.discrete_palette.getRGB(j))
+                                                    tuple(self.discrete_palette.getRGB(j)))
                 polygon.attach(self)
 
         self.replot()
@@ -250,7 +250,7 @@ def callback(i, n):
             self.set_progress(50, 100)
             w, mu, sigma, phi = lac(conts, self.number_of_groups, self.number_of_steps)
             self.set_progress(100, 100)
-            self.groups[key] = map(np.nan_to_num, (phi, mu, sigma))
+            self.groups[key] = list(map(np.nan_to_num, (phi, mu, sigma)))
         return self.groups[key]
 
     def draw_legend(self):
@@ -779,7 +779,7 @@ def create_contingencies(X, callback=None):
     X_ = Discretize(method=EqualFreq(n=10))(X)
     m = []
     for i, var in enumerate(X_.domain):
-        cleaned_values = [tuple(map(str.strip, v.strip('[]()<>=').split(',')))
+        cleaned_values = [tuple(map(str.strip, v.strip('[]()<>=≥').split('-')))
                           for v in var.values]
         try:
             float_values = [[float(v) for v in vals] for vals in cleaned_values]


Test patch: