alifestd_mark_node_depth_polars

alifestd_mark_node_depth_polars(phylogeny_df: DataFrame, *, mark_as: str = 'node_depth') DataFrame

Add column node_depth, counting the number of nodes between a node and the root.

The output column name can be changed via the mark_as parameter.

Parameters

phylogeny_dfpolars.DataFrame or polars.LazyFrame

The phylogeny as a dataframe in alife standard format.

Must represent an asexual phylogeny with contiguous ids and topologically sorted rows.

Returns

polars.DataFrame

The phylogeny with an added node_depth integer column.

See Also

alifestd_mark_node_depth_asexual :

Pandas-based implementation.