ModuleNotFoundError:没有带有bkcharts的名为“ bokeh.plotting.helpers”的模块

时间:2020-06-19 05:56:14

标签: python pandas bokeh

我正在尝试使用 Jupyter Notebook 版本6.0.3中的 bokeh 创建散点图,但它给了我 ModuleNotFoundError:没有名为'bokeh.plotting的模块.helpers',我已经使用pip install bokehpip install bkcharts安装了bokeh和bkcharts。

这是我的代码

from bkcharts import Scatter, output_file, show
import pandas

df=pandas.DataFrame(columns=["X","Y"])
df["X"]=[1,2,3,4,5]
df["Y"]=[5,6,4,5,3]


p=Scatter(df, x="X",y="Y", title="temperature observations", xlabel="Day", ylabel="Temp")

output_file("Scatter_charts.html")
show(p)

1 个答案:

答案 0 :(得分:0)

您不应出于任何原因使用bkcharts。几年前,它已被弃用并从Bokeh主项目中删除。它是 废弃 未维护 。为了今天使用它,您还必须安装古老的Bokeh版本0.12.7(或更旧版本)。

如今,bkcharts可能需要做的任何事情,您都可以使用现代的核心Bokeh软件包来完成。

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

df = pd.DataFrame(columns=["X","Y"])
df["X"] = [1,2,3,4,5]
df["Y"] = [5,6,4,5,3]

p = figure(title="temp observations", x_axis_label="Day", y_axis_label="Temp")
p.scatter(x="X", y="Y", source=df)

output_file("scatter.html")
show(p)

如果您希望在Bokeh之上获得更高级别的API,则可以考虑以下最新的第三方项目之一: