0

So I'm attempting to build a chord diagram using holoviews and bokeh and running into some issues. I found a few posts that were somewhat related, but didn't help me much. Essentially I need help with tackling the error at the end so that I can see how the new chord diagram with the labels and coloring (chord.opts).

Essentially I have a list of names (and their respective business units) and the people they have been paired with in a program. I want to visualize the connections each person has had with a chord diagram.

FULL DISCLOSURE: The code below may be completely wrong...but this is what I came up with after looking at the example.

import holoviews as hv
from holoviews import opts, dim
import pandas as pd
import numpy as np
from bokeh.plotting import figure, output_file, show
from bokeh.io import output_notebook
output_notebook()

hv.extension('bokeh')
hv.output(size=200)

book1 = "../desktop/book3.xls"
pairs = pd.read_excel (book1)

pair_counts = pairs.groupby(['id1', 'id2']).name2.count().reset_index()

pair_counts looks like this: pair_counts

test = hv.Chord(pair_counts)

hv.save(test,'test.png')

This outputs the following picture. test.png

nodes = hv.Dataset(pairs, 'id1', 'bu1')
nodes.data.head()


test2 = hv.Chord((test, nodes)).select(value=(5, None))

After this line I get the following error:

DataError: None of the available storage backends were able to support the supplied data format.

continuing...

test2.opts(
    opts.Chord(cmap='Category20', edge_cmap='Category20', edge_color=dim('bu2').str(), 
               labels='bu1', node_color=dim('bu1').str()))

hv.save(test2,'test2.png')

Here is what the excel data looks like: excel data

And here are the dtypes for the excel data in the df 'pairs':

pairs.dtypes

id1       int64
name1    object
dept1    object
bu1      object
id2       int64
name2    object
dept2    object
bu2      object
dtype: object
cbakhshi
  • 23
  • 7
  • More specifics would help. What's the exact error you're getting? And could you edit into your question a few lines of data from the Excel file? Also, you mention that you get "some text under the cell in the notebook" -- what is that text exactly? – Peter Leimbigler Mar 14 '19 at 00:39
  • Updated the post with your recommended edits. Also, I kept working on it after I posted the question and got closer to a solution so I updated my code above and the error. Thank you in advance for your help. – cbakhshi Mar 14 '19 at 03:31
  • This question would be easier to answer if you supply a fully runnable example, preferably using Python data structures like dictionaries or arrays so that the contents are more easily visible than if they are in a separate file. In any case it looks like the issue is from `hv.Chord((test, nodes))` not being a valid way to construct a Chord plot; you may want `hv.Chord((pair_counts, nodes))`. – James A. Bednar Mar 14 '19 at 15:17
  • Thanks, James. Any insight on why I keep getting that DataError? Everything seems to work until my last few lines, then I get that error. I looked it up, but it seems like it's a generic error that is spit out for a wide variety of things. – cbakhshi Mar 15 '19 at 11:41

0 Answers0