我想用Bokeh绘制变量tmp
。
tmp
有时间戳索引(如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)
在您的数据中,索引具有字符串类型—您从未告诉它它是时间戳
添加以下内容:
相关问题 更多 >
编程相关推荐