Reputation: 145
Trying to read the following into a vbar bokeh chart but it's not rendering anything beyond a blank figure.
Index | Sub Call Type | Calls |Total AHT
0 | Standard Checklist | 33111 |00:07:27
1 | About FSS | 9447 |00:04:40
Trying to go with the following:
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)
Thanks for your help
Upvotes: 1
Views: 1471
Reputation: 1795
You forgot to specify that the data is categorical. This can be done with 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)
Upvotes: 4