alifestd_mark_lineage_cumsum_polars

alifestd_mark_lineage_cumsum_polars(phylogeny_df: DataFrame, values: str | Expr, *, mark_as: str = 'lineage_cumsum', reverse: bool = False, skipna: bool = True) DataFrame

Add column with cumulative sum of values along each lineage.

With reverse=False (default), the result at each node is the sum of values along the path from the root to that node, inclusive. With reverse=True, the result at each node is the sum of values over the entire clade rooted at that node, inclusive.

Parameters

phylogeny_dfpolars.DataFrame or polars.LazyFrame

The phylogeny as a dataframe in alife standard format.

Must represent an asexual phylogeny.

valuesstr or polars.Expr

Column name or polars expression providing per-node values.

mark_asstr, default “lineage_cumsum”

Output column name.

reversebool, default False

If True, aggregate over clade rooted at each node.

skipnabool, default True

If True, NaN values are treated as identity (0); else propagate.

See Also

alifestd_mark_lineage_cumsum_asexual :

Pandas-based implementation.