I have a dataframe:
df = pd.DataFrame({'type': ['flag', 'flag', 'sweets'], 'need_1': [['US'], ['Finland'], ['chocolate'], 'need_2': [['US', ['Britain'], ['licorice'], 'number': [2, 4, 5})
<OUT>
Type need_1 need_2 number
flag US US 2
flag Finland Britain 4
sweet chocolate licorice 5
I wish to create a treemap using Plotly
.
So far I have this:
fig = px.treemap(eet_2022_drop,
path = ['type','need_1', 'need_2''],
values = 'number',
width = 800,
height = 600)
fig.show()
However, I am getting the error:
Non-leaves rows are not permitted in the dataframe
Any ideas what the error is alluding to and how may I be able to fix this? Thanks!