散景服务器-运行应用程序处理程序时出错

时间:2019-11-22 17:11:21

标签: python error-handling server bokeh handler

大家好:我开始使用Bokeh,并使用了适用于我自己的数据的示例“ crossfilter”。 它工作正常,我的确在Jupiter笔记本中看到了交互式绘图。但是,当我尝试使用bokeh服务器时,它在命令提示符下显示如下错误消息: 散景服务-显示myplot.py 运行应用程序处理程序时出错:名称为空 NameError:名称“ null”未定义。 (很抱歉,这可能不是一个新问题,我确实搜索了一些互联网答案,但对我没有用)。任何评论都非常有帮助。

这是我的原始代码:

"""
An example demonstrating how to put together a cross-selector app based
on the FIFA dataset.
"""
hv.extension("bokeh","matplotlib")
import holoviews as hv
import panel as pn
import panel.widgets as pnw

from bokeh.sampledata.autompg import autompg

columns = sorted(df.columns)
discrete = [x for x in columns if df[x].dtype == object]
continuous = [x for x in columns if x not in discrete]
quantileable = [x for x in continuous if len(df[x].unique()) > 20]

x = pnw.Select(name='X-Axis', value='Overall Rating', options=quantileable)
y = pnw.Select(name='Y-Axis', value='Pace', options=quantileable)
size = pnw.Select(name='Size', value='None', options=['None'] + quantileable)
color = pnw.Select(name='Color', value='None', options=['None'] + quantileable)

@pn.depends(x.param.value, y.param.value, color.param.value, size.param.value) 
def create_figure(x, y, color, size):
    opts = dict(cmap='rainbow', width=800, height=600, padding=0.1, line_color='black')
    if color != 'None':
        opts['color'] = color 
    if size != 'None':
        opts['size'] = hv.dim(size).norm()*20
    return hv.Points(df, [x, y], label="%s vs %s" % (x.title(), y.title())).opts(**opts)

widgets = pn.WidgetBox(x, y, color, size, width=200)

pn.Row(widgets, create_figure).servable('Cross-selector')

0 个答案:

没有答案