尝试将以下内容读入vbar散景图中,但未呈现任何空白图。

Index | Sub Call Type      | Calls   |Total AHT
0     | Standard Checklist | 33111   |00:07:27
1     | About FSS          | 9447    |00:04:40


尝试进行以下操作:

import pandas as pd
from bokeh.io import show, output_file
from bokeh.plotting import figure, ColumnDataSource

data = pd.read_csv("Desktop/Graph.csv")

output_file("bar_pandas.html")

source = ColumnDataSource(data=data)

p = figure(plot_height=350,title="Business Heatmap FYTD")

p.vbar(x="Sub Call Type",top="Calls",width=0.5,source=source)

show(p)


谢谢你的帮助

最佳答案

您忘记指定数据为categorical。这可以用x_range=list(catagories)完成

import pandas as pd
from bokeh.io import show, output_file
from bokeh.plotting import figure, ColumnDataSource

data = pd.DataFrame.from_dict({"Sub Call Type": ["Standard Checklist", "About FFS"], "Calls": [33111, 9447], "Total AHT": ["00:07:27", "00:04:40"]})

output_file("bar_pandas.html")

source = ColumnDataSource(data=data)

p = figure(plot_height=350,title="Business Heatmap FYTD", x_range=data["Sub Call Type"])

p.vbar(x="Sub Call Type",top="Calls",width=0.5,source=source)

show(p)

关于python - 散景:ColumnDataSource不在Vbar上呈现,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54432870/

10-09 23:29