X axis as a calendar datetime

hi, and thank you developers for a fantastic work.

i am making django/bokeh app, which will, (also) from bokeh graph data, draw astrological charts.

i am trying to find correlation btw financial prices and astrological events.

normally, on x axis, if dates are involved, one would use datetime field / option.
what i want, is to have on x axis a calendar, starting / ending as per visualized dataset.
i.e., dataset is in format, from *.csv file, prepared via pandas:

date | open

2020/06/04 | 0,6919
2020/06/05 | 0,6942
2020/06/08 | 0,6965
2020/06/09 | 0,7017

obviously, dates
2020/06/06 and
are missing, but i would want to have them on x axis, as any other ‘missing’ date (as in calendar), too.

one option is to fill missing dates manually.

i am asking, is there a simple programmatic way to set x axis data as calendar days, and then populate dates with (existing) datetime from a dataset ?

best regards,

s love nia

Hi @aum it’s not really clear what you are asking for (or what problem you are running in to) from the description above. Things that would help clarify:

  • actual code (ideally a complete, minimal repropducer)
  • screenshots of what happens with that code
  • detailed description of how what happens is different from what you want or expect

If I understand you correctly, there’s no way to do that with Bokeh itself. You will have to fill in the missing data manually.

@p-himik, thx for the reply.
i thought so, since we are basically plotting data, and one of the axis (x in this case) is datetime, which does not necessarily mean it is from calendar (datetime).

s love nia

Here is what is not clear to me: Is the question about appearance, i.e. missing dates on axis? Or about actual missing dates in the data?

Because it sounds like you are rendering the date values you have as categorical factors, which, yes, will only show exactly the dates you pass in. But if you convert them to actual datetime values, and use an actual datetime axis, then there won’t be any “missing” dates because datetime axis is continuous (the dates will just show up in the proper place inside the entire date range)

Or maybe you are really asking whether Bokeh will somehow impute missing data values (the answer is definitely no to that).

But it’s not clear either what you want, or what you’ve tried. This is why it is important to always include some actual code when asking for help.

@Bryan - my Q is about ‘about actual missing dates in the data’.
i am aware that actual code example is appropriate addition, but the (my actual) code is not a problem, it does what it is supposed to do, missing (calendar) dates in my dataset are the problem.

i received a message (thank you carl), and the actual solution to my problem would be here, as it appears:

i am not sure though, since, if i populate missing (calendar) dates with ie value ‘0’, my dataset would change accordingly - minimum value would be zero (0), and not ie 0,6919 (as in 2020/06/04 | 0,6919), so i guess a plotted graph would be somehow misinterpretation.
perhaps adding ‘nan’ or ‘null / empty’ value would be better solution.

best regards,

s love nia