【问题标题】:How does Bokeh store datetime informationBokeh 如何存储日期时间信息
【发布时间】:2020-05-19 01:17:07
【问题描述】:
我正在使用 Javascript 回调将存储在我的散景source 对象中的数据写入 csv。
当我访问 datetime 列时,我得到了一种奇怪的格式。
条目2017-03-16T00:00:00.000000000 的日期表示变为938736000000,这似乎不是纪元毫秒格式。
如何从数字表示中检索可读的日期时间表示?
【问题讨论】:
标签:
javascript
python
datetime
bokeh
epoch
【解决方案1】:
你得到的值可能是微秒格式的时间戳。没有任何源代码就更难诊断您的问题,但您可以尝试以下方法:
from bokeh.models import DatetimeTickFormatter
from bokeh.plotting import figure
然后用它来格式化:
p = figure(plot_width=400, plot_height=400)
p.xaxis.formatter=DatetimeTickFormatter(
hours=["%d %B %Y"],
days=["%d %B %Y"],
months=["%d %B %Y"],
years=["%d %B %Y"],
)
show(p)