gpt4 book ai didi

python - Bokeh 自动填充日期时间轴缺失值 : how to stop it?

转载 作者:行者123 更新时间:2023-11-28 19:04:33 25 4
gpt4 key购买 nike

我正在尝试从财务数据的 pandas dataframe 构建交互式图表。当市场收盘或周末时,Dataframe 指数会有一些缺口。问题是,当我将数据帧索引用作 xasis 时,Bokeh 总是自动填充这些空白,这使得它在视觉上很难看。

Example of Bokeh autofilling gaps in datetime axis.

我怎样才能无间隙地打印我的数据?

最佳答案

如果您在部分之间插入 NaN,Bokeh 将不会填补空白:

source = ColumnDataSource(data=dict(x=[1, 2, 3, np.nan, 10, 20], y=[1, 2, 3, np.nan, 3, 4]))
fig = figure(plot_height=250)
fig.line("x", "y", source=source)
show(fig)

输出:

enter image description here

关于python - Bokeh 自动填充日期时间轴缺失值 : how to stop it?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48528519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com