尝试将以下内容读入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)
感谢您的帮助
答案 0 :(得分:1)
您忘记指定数据为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)