I have following long-format dataframe with two columns containing a nested parent-child hierarchy:
child parent parent_level sf d x st d