New to Bokeh and Python here. I’ve tried searching and am struggling to find the exact thing. I keep thinking it is a simple issue with index number/value but I can’t seem to solve it.
I’ve put a couple charts on a page and am wanting to add a Data Table widget as well. I can get the datatable on there and everything is ALMOST right.
I’m doing a year over year table, so I’m pivoting my data because in the end I want to see a row for each year, then 1 column for each month of the year.
If I pivot this and look at the Pandas dataframe, everything looks great. (top example in picture)

If I put this in a datatable widget though, the months and actuals all line up great…but the year is gone and replaced with what I assume is just a row number/index as shown in the bottom example in picture.
What would be the way I’d go about displaying the year as well? I know there’s something simple here I’m missing…just can’t figure out how I need to reshape.
def make_three_year_table(selected_account):
df = selected_account[['account', 'year', 'month', 'actual']]
df = df.pivot(index='year', columns='month', values='actual')
df = df[['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
'Nov', 'Dec']]
columns = [TableColumn(field=Ci, title=Ci) for Ci in df.columns]
data_table = DataTable(columns=columns, source=ColumnDataSource(df))
return data_table

