 # Bokeh Donut chart - more than 2 layers

Hi guys,

I was asked to post this question here as was not able to solve it with post a lot of googling and asking some experts as well… I believe this is not yet implemented in Bokeh Donut charts, but would like to ask if there is any workaround it? My data has 4-5 layers and I would like to show drill down all the way

Below is my code (I am a complete newb pls - really appreciate your help)

from bokeh.charts import Donut, show, output_file, output_notebook
import numpy as np
import pandas as pd
import os
import random

## generate a table fo random values for our given columns, and specify how many rows should be in there

#components of each columns
kountry = [‘HongKong’,‘Singapore’,‘India’,‘China’,‘Malaysia’]
type=[‘abc’,‘def’,‘ghi’,‘jkl’]
tenor=[‘1m’,‘3m’,‘6m’,‘9m’,‘12m’,‘15m’,‘2y’]
Cpty=list(“ABCDEFGHIJKLMNOPQRTSUVQXYZ”)
currency=[‘HKD’,‘SGD’,‘INR’,‘CNH’,‘MYR’]
#simulate random values in each column from the given list of items
df1 = pd.DataFrame(np.random.choice(kountry,20))
df3 = pd.DataFrame(np.random.choice(tenor,20))
df4 = pd.DataFrame(np.random.choice(Cpty,20))
df5 = pd.DataFrame(np.random.choice(currency,20))
df6 = pd.DataFrame(np.random.randint(0,high=3000,size=20))
ddf = [df1,df2,df3,df4,df5,df6]
df = pd.concat(ddf,axis=1)
df.columns = [“Country”,“Type”,“Tenor”,“Cpty”,“CCY”,“cc”]
ddf=df.sort_values(‘Country’,ascending=True)
#pd.pivot_table?
#ddf = pd.pivot_table(ddf, values=‘cc’, index=[‘Country’,‘Type’,‘Tenor’,‘Cpty’,‘CCY’],aggfunc=np.sum)
d = Donut(ddf, label=[‘Country’,‘Type’,‘Tenor’],values=‘cc’,agg=‘sum’) #works fine if I remove ‘Tenor’, and have 2 layesrs basically
output_notebook()
show(d)

Error I get is: NotImplementedError: merging with more than one level overlap on a multi-index is not implemented

Thanks vm!