alifestd_to_working_format_polars
- alifestd_to_working_format_polars(phylogeny_df: DataFrame, keep_ancestor_list: bool = False) DataFrame
Re-encode phylogeny_df to facilitate efficient analysis and transformation operations.
The returned phylogeny dataframe will * be topologically sorted (i.e., organisms appear after all ancestors), * have contiguous ids (i.e., organisms’ ids correspond to row number), * contain an integer datatype ancestor_id column if the phylogeny is asexual (i.e., a more performant representation of ancestor_list).
Parameters
- phylogeny_dfpolars.DataFrame
The phylogeny as a dataframe in alife standard format.
- keep_ancestor_listbool, default False
If True and ancestor_list was present in the input, regenerate the ancestor_list column from the (reassigned) ancestor_id column. The column is dropped during processing in all cases; it is only restored when this flag is set and the input already had it.
See Also
- alifestd_to_working_format :
Pandas-based implementation.