Hi,
I’m planning to do some charts from a dataframe which columns’ names are Timestamps. Pandas work well with that but Bokeh doesn’t accept this kind of column names apparently.
Sample code:
from datetime import datetime, timedelta
from bokeh.plotting import figure
from bokeh.io import output_notebook
import numpy as np
import pandas as pd
output_notebook()
todays_date = datetime.now().date()
dates = pd.date_range(todays_date-timedelta(5), periods=5, freq=‘D’)
maturities = pd.date_range(todays_date, periods=12, freq=‘M’)
m = maturities[6]
d = dates[2]
data = pd.DataFrame(np.random.randn(12,5), index=maturities, columns=dates)
p = Line(data=data, x=‘index’, y=d)
p.show()
``
Output (tail):
ValueError: expected an element of either Column Name or Column String or List(Column Name or Column String), got Timestamp(‘2015-11-02 00:00:00’, offset=‘D’)
``
Is this expected behavior or a case that Bokeh doesn't handle yet but should?
As a consequence, I have a few related questions about possible inputs:
- this doesn't work either and I don't understand why not: "p = Line(x=data.index, y=data[d].values)"
- what is the difference between a column name or column string?
- can bokeh handle multi-level columns?
Regards
Alex