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
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))
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))