Holoview Hover: error displaying attribute information in tooltip

I am trying to do a heatmap of a dataframe with 4 columns:

  • triad_type: string
  • engagment: string
  • proportion: float64
  • nodes: object (a list of tuples eg. [(…),(…),(…),(…), … ,(…),(…),(…)]

What I want is that when I hover over a cell in the heatmap, that the tooltip will show the list of tuples.
When I implement this using:

hv.HeatMap(triad_heatmap_df, kdims=['engagement','triad_type'], vdims=['proportion', 'nodes'],
                      group='Proportions of Triad Types')

I get the following error:

SystemError: <built-in method view of numpy.ndarray object at 0x7ff0af90ae90> returned a result with an error set 

The relevant part of the stack trace (below) seems to show that holoviews is trying to sort the ‘nodes’ column data. If that is the case, is it possible to prevent a ‘sort’ attempt? Or is there a much better way to do this?

~/miniconda3/lib/python3.8/site-packages/holoviews/core/data/__init__.py in range(self, dim, data_range, dimension_range)
    461             by = [by]
    462         sorted_columns = self.interface.sort(self, by, reverse)
--> 463         return self.clone(sorted_columns)
    464 
    465 

~/miniconda3/lib/python3.8/site-packages/holoviews/core/data/pandas.py in range(cls, dataset, dimension)
    166                 column = column.sort(inplace=False)
    167             else:
--> 168                 column = column.sort_values()
    169             column = column[~column.isin([None])]
    170             if not len(column):

~/miniconda3/lib/python3.8/site-packages/pandas/core/series.py in isin(self, values)
   4292         Name: animal, dtype: bool
   4293         """
-> 4294         result = algorithms.isin(self, values)
   4295         return self._constructor(result, index=self.index).__finalize__(self)
   4296 

~/miniconda3/lib/python3.8/site-packages/pandas/core/algorithms.py in isin(comps, values)
    451             comps = comps.astype(object)
    452 
--> 453     return f(comps, values)
    454 
    455 

pandas/_libs/hashtable_func_helper.pxi in pandas._libs.hashtable.ismember_object()

SystemError: <built-in method view of numpy.ndarray object at 0x7ff0af90ae90> returned a result with an error set

I don’t know if that will return what you want but you can try to cast your nodes column into str before making the heatmap.

triad_heatmap_df.nodes = triad_heatmap_df.nodes.astype(str)

Dude! That worked perfectly for my uses. Tnx.