Skip to main content

system.kanoa.utilities.createTreeHierarchy

This function is not part of a class and can be used independently.

Description

Takes a dataset and appends an extra 'path' column based on the passed-in levels. Levels are column names that the data will be grouped by. For example, if levels are 'column1', 'column2', 'column3', the path of a row will be "value1\value2\value3".

Syntax

createTreeHierarchy(inputData, *levels)
  • Parameters:
      inputData: dataset
      *levels: tuple - i.e., column1, column2, column3
  • Returns:
      data - dataset
  • Code Example

    # Example Usage:
    data = system.kanoa.utilities.createTreeHierarchy(inputData, 'ItemClassCode', 'ItemClassName', 'ItemName')