Hello - Iβm having an issue with increasing the level of granularity in a sunburst chart. The chart renders fine when I limit the path to two levels of granularity (CUR_FIN_CLASS and CUR_PAYOR):
but when including an additional path (AGING_BUCKET), I continually receive a ZeroDivisionError. It must be how the px.sunburst function is calculating the outermost slices. Any idea how I might prep the data in the pivot_table call to proof it so when passed into the px.suburst function, I avoid the ZeroDivisionError? Any help would be greatly appreciated!
Here is my code:
def ArSnBrstdf(dataFrame):
df = dataFrame
df = pd.pivot_table(df, values='OUTSTANDING_AMT',index=['CUR_FIN_CLASS','CUR_PAYOR','AGING_BUCKET'], aggfunc=np.sum,fill_value=None,dropna=True).reset_index()
df['ALL'] = 'PAYOR_DATA'
fig = px.sunburst(df, path=['ALL','CUR_FIN_CLASS','CUR_PAYOR','AGING_BUCKET'],values='OUTSTANDING_AMT',
color='OUTSTANDING_AMT',
color_continuous_scale='gnbu',
)
fig.show()
#return df
ArSnBrstdf(dfAr)