I need some help with using bokeh in python. I want to use the hovertool to display two varibles in a interactive dot map. But, I am getting "???" instead of the values of the variables. So for example, i want the type variable to display, but instead of dog, cat, bird, etc... displaying, "???" displays when i hover over the dots.
from bokeh.plotting import figure, show, output_notebook
from bokeh.tile_providers import get_provider, Vendors
get_provider(Vendors.CARTODBPOSITRON)
from bokeh.models import ColumnDataSource, HoverTool
source = ColumnDataSource(data=dict(
x=list(Pet_Data['Latitude']),
y=list(Pet_Data['Longitude']),
Type=list(Pet_Data['Type']),
Age=list(Pet_Data['Age'])))
hover = HoverTool(tooltips=[
("Age", "@Age"),
("Type","@Type")
])
p = figure(x_axis_type="mercator",
y_axis_type="mercator",
tools=[hover, 'wheel_zoom','save'])
p.add_tile(CARTODBPOSITRON)
p.circle(x='Age',
y='Type',
source=source,
size=2,
line_color="#FF0000",
fill_color="#FF0000",
fill_alpha=0.05)
output_notebook()
show(p)
@Age
means "display values from the "Age" column in the ColumnDataSource
. Looking above, you do not have any column named "Age" (or "Type") in your data source. (You have columns "x", "y", "name", and "inspection" and nothing else.) If you want to use these columns in a hover tool, you would need to add them to the data source.