bayesline.api.equity.hierarchy_to_df

bayesline.api.equity.hierarchy_to_df#

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

Convert a hierarchy to a DataFrame.

Parameters#

hierarchyHierarchy

The hierarchy to convert to a DataFrame.

hierarchies_labelsMapping[str, str]

The labels to use for the hierarchy.

Returns#

pl.DataFrame

The DataFrame representation of the hierarchy. The columns are: - level: The level of the hierarchy. - code: The code of the hierarchy. - label: The label of the hierarchy. - parent_code: The parent code of the hierarchy.