# Feature Request : Functionality to hide empty leaves in tree map

**URL:** <https://community.plotly.com/t/feature-request-functionality-to-hide-empty-leaves-in-tree-map/63256>\
**Category:** 📊 Plotly Python\
**Tags:** community-components, tips-and-tricks, question\
**Created:** [April 21, 2022, 1:31am UTC](https://community.plotly.com/t/feature-request-functionality-to-hide-empty-leaves-in-tree-map/63256 "2022-04-21T01:31:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ameyakambli](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@ameyakambli](https://community.plotly.com/u/ameyakambli)\
**Post date:** [April 21, 2022, 1:31am UTC](https://community.plotly.com/t/feature-request-functionality-to-hide-empty-leaves-in-tree-map/63256/1 "2022-04-21T01:31:12Z")

</div>

```auto
       0 1 2 3 4
0 alice bob chuck david ella
0 alice bob chuck david fred
0 alice bob chuck NaN NaN

```

Error : Non-leaves rows are not permitted in the dataframe

I want chuck to only show david as a child without a need to fill NaN (Hide empty box). when you have a None value in the last path column, its parent must be a leaf, ie its parents cannot have other children than None. i cannot even use dropna(). Is there any solution to bypass this issue ?

For now the workaround that i am using replacing NaN by text as “end of hierarchy”

As far as i understand the issue is because of the following code in `plotly/express/_core.py`

```auto
    for i, row in enumerate(row_strings[:-1]):
        if row_strings[i + 1] in row and (i + 1) in null_indices:
            raise ValueError(
                "Non-leaves rows are not permitted in the dataframe \n",
                df_sorted.iloc[i + 1],
                "is not a leaf.",
            )

```
