How do I replace %NaN with, e.g., "-" in Bokeh tooltips

Viewed 206

So I've got this bit of code like this as part of a bokeh plot that's being generated from a pandas DataFrame:

tooltips=[
( 'date',     '@fcstdate{%F}'          ),
( 'actuals',  '$@actvol{0.00 a}'       ),
( 'forecast', '$@projvol{0.00 a}'      ),
( 'plan',     '$@planvol{0.00 a}'      ),
            ],

So you see here an example of the output:

Bokeh tooltip

It's returning "actuals: %NaN" because for that period there are no actuals. I would like to format it such that when the value is null it displays a dash (e.g. "-").

What's the cleanest way to do that, and ideally in the tooltip code above rather than in the DataFrame, if possible?

0 Answers
Related