gpt4 book ai didi

python - Bokeh: DateRangeSlider decreases the year by 1 when the chosen start date is Jan 1st

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

当我在 SO 上尝试使用 DateRangeSlider 解决另一个问题时,我发现 slider 上的​​开始日期 01/01/2017 已更改为 01/01/2016。当我将日期滑动到 1 月 2 日时,它正确显示了年份。这似乎是一个错误。如果没有,我该如何解决?

DateRangeSlider example

下面是我使用的代码:

from datetime import date

from bokeh.models.widgets import DateRangeSlider
from bokeh.layouts import layout

from bokeh.io import curdoc

date_range_slider = DateRangeSlider(title="Date Range: ", start=date(2017, 1, 1), end=date.today(), value=(date(2017, 9, 7), date(2017, 10, 15)), step=1)

l = layout(children=[[date_range_slider]], sizing_mode='fixed')
curdoc().add_root(l)
curdoc().title = "DateRangeSlider Example"

最佳答案

这在以前的版本中是一个问题,但现在已经修复了。 Bokeh 0.12.10,例如,按预期显示您的代码:

enter image description here

所以答案是升级到具有修复的较新版本。

关于python - Bokeh: DateRangeSlider decreases the year by 1 when the chosen start date is Jan 1st,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46786505/

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