我怎样才能在博基赫拍出“Pandas。核心。系列。系列”?

2024-04-23 08:36:16 发布

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

我想用Bokeh绘制变量tmptmp有时间戳索引(如2011-01-29)和整数(如1000)

tmp是“pandas.core.series.series”

output_notebook()

p = figure(title='title', 
           x_axis_type='datetime',  
           x_axis_label='timestamp', 
           y_axis_label='quantity',
           width=800,height=350
          )
p.line(x=tmp.index, y=tmp.values)
show(p)

这个代码给了我一个空图

下面的脚本正在生成示例数据

import pandas

origin_data = pd.DataFrame({
    "A":[10000, 10001, 10002, 10003, 10004],
    "B":[20000, 20001, 20002, 20003, 20004]

},
index = ["2011-01-29", "2011-01-30", "2011-01-31", "2011-02-01", "2011-02-02"])

tmp = tmp.sum(axis=1)

Tags: corepandasoutputindextitle时间bokeh绘制