I want to create a sunburst from plotly express but it seems I have a problem in my values.
Indeed, nothing shows up when trying to plot. But when I comment the values part the sunburst is showed (without the values).
I am creating the sunburst figure with:
fig = px.sunburst(
data,
names='asset_and_liability',
parents='parent',
values='value',
)
The data is a dictionnary with 3 fields:
data = dict(
asset_and_liability =[financial_status, "total_assets", "total_liabilities"]+
["total_current_assets"] + current_assets.keys().tolist() + ["total_non_current_assets"]
+ non_current_assets.keys().tolist(),
parent=["", financial_status, financial_status, "total_assets", *["total_current_assets"]
* len(current_assets), "total_assets",
*["total_non_current_assets"] * len(non_current_assets)],
value = [ratio, total_assets, total_liabilities] + [sum(current_assets)]
+ current_assets.values.tolist() + [sum(non_current_assets)] + non_current_assets.values.tolist()
The values are:
>>> for var in data:
for i in var.keys():
print(len(var[i]), var[i])
print("\n")
14 ['Conservatively financed', 'total_assets', 'total_liabilities', 'total_current_assets', 'cash', 'shortTermInvestments', 'netReceivables', 'inventory', 'otherCurrentAssets', 'total_non_current_assets', 'propertyPlantEquipment', 'goodWill', 'intangibleAssets', 'otherAssets']
14 ['', 'Conservatively financed', 'Conservatively financed', 'total_assets', 'total_current_assets', 'total_current_assets', 'total_current_assets', 'total_current_assets', 'total_current_assets', 'total_assets', 'total_non_current_assets', 'total_non_current_assets', 'total_non_current_assets', 'total_non_current_assets']
14 [3.7051177031436744, 275909000000, 74467000000, 152578000000, 18498000000, 101177000000, 27492000000, 999000000, 4412000000, 110253000000, 84587000000, 20624000000, 1979000000, 3063000000]