to_pandas

CondensedTree.to_pandas()

Returns a pandas dataframe of the condensed tree.

The columns are: parent, child, distance, density, child_size. The parent labelling starts at num_points, which represents a phantom root. All points connecting directly to the (multiple) tree roots have num_points as their parent. The labels for the tree roots themselves occur only as a parent and start from num_points + 1.

Due to this construction, we cannot recover which points belong to which tree root (if there are multiple trees). In addition, the first parent value cannot be used to find num_points, as it can be the first tree-root value num_points + 1! All parents that do not occur as children should be considered a child of the phantom root.