I am new to both Bokeh and Pandas and I am trying to generate a grouped bar chart from some query results.
My data looks something like this
Day Fruit Count
----------- -------- -------
2020-01-01 Apple 19
2020-01-01 Orange 8
2020-01-01 Banana 7
...
2020-02-23 Apple 15
2020-02-23 Orange 10
2020-02-23 Banana 12
2020-02-24 Apple 12
2020-02-24 Orange 17
2020-02-24 Banana 9
In the answers with the old deprecated bokeh.charts API this data layout seems trivial to deal with.
I am having a real hard time understanding what is going on with the grouped chart example from the up to date API, and how to get my data into the format into the format shown in the example.
I tried generating a new column in my data frame that has a touple of day, fruit using a transform, but that fails with errors I don't understand. I don't even know if this is the right approach.
# add a grouped axis for group the bar chart
def grouped_axis (row ):
return ( row['Day'], row['Fruit'] )
data_frame['day_fruit']=data_frame2.apply ( lambda row: grouped_axis(row), axis=1 )
Can someone point me to an example that uses this kind of data? Or failing that, explain the code I need to get Bokeh to understand my data as a grouped bar chart?