make_bokeh_hepler.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:ProductAnalysis 作者: Jasonhy 项目源码 文件源码
def make_hot_bokeh(data):
    from bokeh.models import BoxAnnotation
    if data:
        data = data.split(",")
        dt1 = datetime.datetime.now()
        temp = list(set(data))
        sub_dates = [(dt1 - datetime.datetime.strptime(dt, '%Y-%m-%d')).days for dt in temp]

        s = pd.Series(sub_dates, [datetime.datetime.strptime(dt, '%Y-%m-%d') for dt in temp])
        s = s.sort_index(ascending=False)

        p = figure(x_axis_type="datetime", tools="",title="??", x_axis_label='??', y_axis_label='??',width=400, height=400)

        p.line(s.index,s.values, legend="??????", line_width=2)

        script, div = components(p, CDN)

        return [script, div]
    else:
        return [0,file_hepler.get_image_path("no_hot.png")]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号