# I'm trying to create a plotly sunburst plot but get error message: 'dtype: object, 'is not a leaf.'

**URL:** <https://community.plotly.com/t/im-trying-to-create-a-plotly-sunburst-plot-but-get-error-message-dtype-object-is-not-a-leaf/44326>\
**Category:** 📊 Plotly Python\
**Created:** [August 29, 2020, 2:51pm UTC](https://community.plotly.com/t/im-trying-to-create-a-plotly-sunburst-plot-but-get-error-message-dtype-object-is-not-a-leaf/44326 "2020-08-29T14:51:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sannehombroek](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/sannehombroek/32/12365_2.png) [@sannehombroek](https://community.plotly.com/u/sannehombroek)\
**Post date:** [August 29, 2020, 2:51pm UTC](https://community.plotly.com/t/im-trying-to-create-a-plotly-sunburst-plot-but-get-error-message-dtype-object-is-not-a-leaf/44326/1 "2020-08-29T14:51:20Z")

</div>

I’m trying to create a sunburst plot where different rows have different lengths, and get the error message 'dtype: object, ‘is not a leaf.’ I have read this ‘Note that the parents of None entries must be a leaf, i.e. it cannot have other children than None (otherwise a ValueError is raised).’ on the plotly pages [Sunburst charts in Python](https://plotly.com/python/sunburst-charts/#rectangular-data-with-missing-values) but don’t fully understand that.

I have a bigger dataset, but the same thing happens with this one:

```auto
testdf = pd.DataFrame(
[['Max',10,'M','a', 'x',None],
['Ma',5, 'M', 'a', None,None],
['Johan',6, 'J','o','h','a']],
index=[1, 2, 3],
columns=['First_Name','Count','a', 'b', 'c','d'])
testdf

fig=px.sunburst(testdf,path=['a','b','c','d'],values='Count')
fig.show()

```

The ValueError is this:

> ValueError: (‘Non-leaves rows are not permitted in the dataframe \n’, a M b a c  
> d  
> Name: 1, dtype: object, ‘is not a leaf.’)

So I think it’s caused by the fact that the letter a is not a leaf since the x of the first row is also attached to it, but I would like to have the sunburst stop at the letter a for the second row, and at the letter x for the first row. Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![yhs](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/yhs/32/18820_2.png) [@yhs](https://community.plotly.com/u/yhs)\
**Post date:** [April 13, 2022, 2:48am UTC](https://community.plotly.com/t/im-trying-to-create-a-plotly-sunburst-plot-but-get-error-message-dtype-object-is-not-a-leaf/44326/2 "2022-04-13T02:48:06Z")

</div>

Hi, did you find the solution? I bumped into the same question too. Thanks.
