为什么bokeh抱怨缺少收费表属性?

2024-04-26 12:24:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使stacked bar plot example适应某些现有数据。在

我的数据帧的结构与示例中提供的类似。它可以作为CSV找到here。在

这是我的代码:

from bokeh.charts import Bar, output_file, show
from bokeh.charts.attributes import cat, color
from bokeh.charts.operations import blend

bar = Bar(
    df,
    values=blend('farfetch','harrods', 'lyst', 'mrporter','nastygal','neimanmarcus','netaporter','theoutnet','yoox', name='retailers', labels_name='retailers'),
    label=cat(columns='index', sort=False),
    stack=cat(columns='retailers', sort=False),
    tooltips=[('retailers', '@retailers'), ('brands', '@index')]
)

show(bar)

执行此代码后,我得到以下堆栈跟踪:

^{pr2}$

为什么会这样?在


Tags: columns数据代码namefromimportindexshow