

def stacked(df, categories):
    areas = dict()
    last = np.zeros(len(df[categories[0]]))
    for cat in categories:
        next = (last + df[cat])
        areas[cat] = np.hstack((last[::(- 1)], next))
        last = next
    return areas

dataset/ETHPy150Open bokeh/bokeh/examples/plotting/file/brewer.py stacked/original