hfs.get_columns_for_numpy_hierarchy¶
- hfs.get_columns_for_numpy_hierarchy(hierarchy: DiGraph, num_columns: int)[source]¶
Get mapping from hierarchy nodes to columns after hierarchy transformation.
If each node in the hierarchy is named after a column’s index this methods will give you the mapping from column index to node name of the node after the graph was transformed to a numpy array and back. During this transformation the node names are lost and afterwards each node is named after its index in hierarchy.nodes.
- Parameters
- hierarchynetworkx.DiGraph
The Directed Acyclic Graph (DAG) representing the hierarchy.
- num_columnsbool
The number of columns in the dataset.
- Returns
- columnslist
A mapping from nodes to columns.