コード例 #1
0
def stack_cumsum(df, y_col):
    '''Submethod to cumsum over y columns for stacked area plot'''
    y_col_list = util.cast_list(y_col)
    stack_df = df.copy()
    for idx in range(len(y_col_list)):
        col = y_col_list[idx]
        presum_idx = idx - 1
        if presum_idx > -1:
            presum_col = y_col_list[presum_idx]
            stack_df[col] += stack_df[presum_col]
    return stack_df
コード例 #2
0
ファイル: viz.py プロジェクト: ronald-xie/SLM-Lab
def stack_cumsum(df, y_col):
    '''Submethod to cumsum over y columns for stacked area plot'''
    y_col_list = util.cast_list(y_col)
    stack_df = df.copy()
    for idx in range(len(y_col_list)):
        col = y_col_list[idx]
        presum_idx = idx - 1
        if presum_idx > -1:
            presum_col = y_col_list[presum_idx]
            stack_df[col] += stack_df[presum_col]
    return stack_df
コード例 #3
0
ファイル: test_util.py プロジェクト: zimoqingfeng/SLM-Lab
def test_cast_list(test_list, test_str):
    assert _.is_list(test_list)
    assert _.is_list(util.cast_list(test_list))

    assert not _.is_list(test_str)
    assert _.is_list(util.cast_list(test_str))
コード例 #4
0
ファイル: test_util.py プロジェクト: ronald-xie/SLM-Lab
def test_cast_list(test_list, test_str):
    assert ps.is_list(test_list)
    assert ps.is_list(util.cast_list(test_list))

    assert not ps.is_list(test_str)
    assert ps.is_list(util.cast_list(test_str))