散景在绘制 DataFrame 时崩溃
Bokeh crashes when plotting DataFrame to scatter
更新 3:已在 python 2 上运行,查看答案
更新 2:在 Python 3.5.2 上 运行 非常好,python 3 具有相同的散景版本。我想这使它成为 python 2具体错误,我会报告。
更新:我使用的是 bokeh 的上游版本 0.12.5 和 python 2.7.12
当我尝试从看似有效的 pandas 数据帧制作散点图时,Bokeh 崩溃了。
我找不到数据帧有任何问题,Here it is in json format 所以你可以反序列化它并自己检查它。
这是回溯
File ".../plotting.py", line 13, in scatter
p=Scatter(df, plot_width=1000, plot_height=500, sizing_mode='stretch_both')
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builders/scatter_builder.py", line 65, in Scatter
return create_and_build(ScatterBuilder, data, **kws)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builder.py", line 56, in create_and_build
chart.add_builder(builder)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/chart.py", line 153, in add_builder
builder.create(self)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builder.py", line 512, in create
chart.add_renderers(self, renderers)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/chart.py", line 148, in add_renderers
self.renderers += renderers
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/core/property/containers.py", line 76, in wrapper
result = func(self, *args, **kwargs)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/core/property/containers.py", line 172, in __iadd__
return super(PropertyValueList, self).__iadd__(y)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builders/scatter_builder.py", line 95, in yield_renderers
marker=group['marker'])
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/glyphs.py", line 130, in __init__
super(PointGlyph, self).__init__(**kwargs)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/models.py", line 84, in __init__
self.setup()
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/models.py", line 90, in setup
self.refresh()
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/models.py", line 99, in refresh
data = self.build_source()
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/glyphs.py", line 57, in build_source
str_labels = [str(label) for label in labels]
TypeError: 'NoneType' object is not iterable
我很想知道我的数据框出了什么问题,我该如何让它工作。
I opened an issue on the Bokeh github 显然你需要指定 X 轴和 Y 轴才能工作:
p=Scatter(df,
x="Fraction of deaths caused by G20: Parkinson disease",
y="Fraction of deaths caused by I64: Stroke")
更新 3:已在 python 2 上运行,查看答案
更新 2:在 Python 3.5.2 上 运行 非常好,python 3 具有相同的散景版本。我想这使它成为 python 2具体错误,我会报告。
更新:我使用的是 bokeh 的上游版本 0.12.5 和 python 2.7.12 当我尝试从看似有效的 pandas 数据帧制作散点图时,Bokeh 崩溃了。
我找不到数据帧有任何问题,Here it is in json format 所以你可以反序列化它并自己检查它。
这是回溯
File ".../plotting.py", line 13, in scatter
p=Scatter(df, plot_width=1000, plot_height=500, sizing_mode='stretch_both')
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builders/scatter_builder.py", line 65, in Scatter
return create_and_build(ScatterBuilder, data, **kws)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builder.py", line 56, in create_and_build
chart.add_builder(builder)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/chart.py", line 153, in add_builder
builder.create(self)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builder.py", line 512, in create
chart.add_renderers(self, renderers)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/chart.py", line 148, in add_renderers
self.renderers += renderers
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/core/property/containers.py", line 76, in wrapper
result = func(self, *args, **kwargs)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/core/property/containers.py", line 172, in __iadd__
return super(PropertyValueList, self).__iadd__(y)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/builders/scatter_builder.py", line 95, in yield_renderers
marker=group['marker'])
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/glyphs.py", line 130, in __init__
super(PointGlyph, self).__init__(**kwargs)
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/models.py", line 84, in __init__
self.setup()
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/models.py", line 90, in setup
self.refresh()
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/models.py", line 99, in refresh
data = self.build_source()
File "/home/shep/.local/lib/python2.7/site-packages/bokeh/charts/glyphs.py", line 57, in build_source
str_labels = [str(label) for label in labels]
TypeError: 'NoneType' object is not iterable
我很想知道我的数据框出了什么问题,我该如何让它工作。
I opened an issue on the Bokeh github 显然你需要指定 X 轴和 Y 轴才能工作:
p=Scatter(df,
x="Fraction of deaths caused by G20: Parkinson disease",
y="Fraction of deaths caused by I64: Stroke")