How to make the tree graph ignore the empty cells in the dataframe?

The dataframe iโ€™m using to create the tree graph has both parent and children cells empty sometimes. After modifing them to โ€˜noneโ€™, the tree graph works, but it displays all the โ€˜noneโ€™ parents and childrens, wich make the graph a bit confusing and less pretty. The only solution i could think was to modify the dataframe, bringing the children cells back, placing them on the empty cells. But i would like to know if there is, i dont know, a buil-in way for plotly to ignore the empty cells on tree graphs somehow ?

def grafico_arvore(dataframe):
                    import as px
                    import numpy as np
                    import pandas as pd
                    df = dataframe

                    #df["world"] = "world" # in order to have a single root node
                    fig = px.treemap(df, path=['categoria1', 'categoria2'], values='gastos',
                                      color='teto', hover_data=['categoria2'],
                                      color_continuous_midpoint=np.average(df['teto'], weights=df['gastos']))

Part of the dataframe alredy modified to replace the empty cells with โ€˜noneโ€™: