bayesline.api.equity.hierarchy_df_to_wide

bayesline.api.equity.hierarchy_df_to_wide#

bayesline.api.equity.hierarchy_df_to_wide(hierarchy: Hierarchy, hierarchies_labels: Mapping[str, str]) DataFrame#

Convert a hierarchy to a wide DataFrame.

Parameters#

hierarchyHierarchy

The hierarchy to convert to a wide DataFrame.

hierarchies_labelsMapping[str, str]

The labels to use for the hierarchy.

Returns#

pl.DataFrame

The wide DataFrame representation of the hierarchy. The columns are: - level_1: The code of the root level. - level_1_label: The label of the root level. - level_2: The code of the second level. - level_2_label: The label of the second level. - … - level_n: The code of the n-th level. - level_n_label: The label of the n-th level.