bayesline.api.equity.settings_tools

bayesline.api.equity.settings_tools#

Functions

assert_no_empty_branches(hierarchy[, ...])

Assert that the hierarchy is not empty or has empty branches.

check_all_codes_have_labels(hierarchies, labels)

Check that all hierarchy codes have corresponding labels.

check_unique_hierarchy(v)

Check that all hierarchies have unique codes.

codes_to_labels(hierarchy, labels, *[, prefix])

Return the hierarchy with all codes replaced by their labels.

effective_hierarchy(hierarchy, include, ...)

Return the hierarchy based on the include and exclude filters.

effective_leaves(hierarchy, include, ...[, ...])

Return the leaves based on the include and exclude filters.

filter_labels_to_hierarchy(hierarchy, labels)

Filter the labels to only include those present in the hierarchy.

filter_leaves(hierarchy, fn)

Filter leaves in a hierarchy based on a predicate function.

find_in_hierarchy(hierarchy, needle)

Find a needle in a hierarchy.

find_in_hierarchy_depth(hierarchy, needle, *)

Find the depth of a needle in a hierarchy.

flatten(hierarchy[, only_leaves])

Flatten a hierarchical structure into a list of codes.

get_depth(hierarchy)

Get the depth of a hierarchy.

hierarchy_df_to_wide(hierarchy, ...)

Convert a hierarchy to a wide DataFrame.

hierarchy_to_df(hierarchy, hierarchies_labels)

Convert a hierarchy to a DataFrame.

labels_to_codes(hierarchy, labels, *[, prefix])

Return the hierarchy with all labels replaced by their codes.

map_hierarchy(hierarchy, fn)

Apply a function to all codes in a hierarchy.

process_excludes(hierarchy, reference_hierarchy)

Process the excludes (prefixed with ~) for a hierarchy.

trim_to_depth(hierarchy, depth)

Trim a hierarchy to a given depth.

validate_hierarchy_filters(hierarchy, ...)

Validate the hierarchy filters.

validate_hierarchy_schema(available_schemas, ...)

Validate that a hierarchy schema exists in the available schemas.