toucan_data_sdk/utils/postprocess/waterfall.py
def _compute_upper_group(df):
    """
    Compute upperGroup
    Args:
        df (Dataframe):

    Returns: Dataframe

    """
    upper_group = df.groupby(['groups']).agg({
        'value': sum,
        'value_start': sum,
        'upperGroup_label': 'first',
        'upperGroup_order': 'first'
    }).reset_index()
    upper_group['type'] = 'parent'
    upper_group['variation'] = upper_group['value'] / upper_group[
        'value_start']
    upper_group.drop(['value_start'], axis=1, inplace=True)
    upper_group.rename(columns={'upperGroup_label': 'label'}, inplace=True)
    return upper_group
def _compute_upper_group(df):
    """
    Compute upperGroup
    Args:
        df (Dataframe):

    Returns: Dataframe

    """
    upper_group = df.groupby(['groups']).agg({
        'value': sum,
        'value_start': sum,
        'upperGroup_label': 'first',
        'upperGroup_order': 'first'
    }).reset_index()
    upper_group['type'] = 'parent'
    upper_group['variation'] = upper_group['value'] / upper_group[
        'value_start']
    upper_group.drop(['value_start'], axis=1, inplace=True)
    upper_group.rename(columns={'upperGroup_label': 'label'}, inplace=True)
    return upper_group
def _compute_upper_group ( df ) : upper_group = df . groupby ( [ 'groups' ] ) . agg ( { 'value' : sum , 'value_start' : sum , 'upperGroup_label' : 'first' , 'upperGroup_order' : 'first' } ) . reset_index ( ) upper_group [ 'type' ] = 'parent' upper_group [ 'variation' ] = upper_group [ 'value' ] / upper_group [ 'value_start' ] upper_group . drop ( [ 'value_start' ] , axis = 1 , inplace = True ) upper_group . rename ( columns = { 'upperGroup_label' : 'label' } , inplace = True ) return upper_group
Compute upperGroup
    Args:
        df (Dataframe):

    Returns: Dataframe
Compute upperGroup Args : df ( Dataframe ) :