Python Bokeh无法导入

2024-04-29 04:26:25 发布

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

我正在尝试使用Bokeh和下面的代码查看数据,但Bokeh无法导入。我用的是jupyter笔记本

from bokeh.plotting import figure,show
from bokeh.model import HoverTool

TOOLTIPS = HoverTool(tooltips = [
    ("index", "$index"),
    ("(Wage,Value)", "(@Wage, @Value)"),
    ("Name", "@Name")]
)
p = figure(title="Soccer 2219", x_axis_label='Wage', y_axis_label='Value', plot_width = 700, plot_height = 700, tools=[TOOLTIPS])
p.circle('Wage', 'Value', size = 10, source = df1)
show(p)

错误消息:

ImportError                               Traceback (most recent call last)
<ipython-input-1-c4834377f869> in <module>
      1 from bokeh.plotting import figure,show
----> 2 from bokeh.model import HoverTool
      3 
      4 TOOLTIPS = HoverTool(tooltips = [
      5     ("index", "$index"),

ImportError: cannot import name 'HoverTool' from 'bokeh.model'

Tags: namefromimportindexmodelvalueshowbokeh