Hello everyone!
I am new to programming and I started using python a few weeks ago in order to do some basic data analysis.
I started using bokeh to create some boxplots which prooved to be easy with nice results and then I moved on to bar charts.
For the bar chart the data I use is a DataFrame of 594 rows and 26 columns named df_rolling
Using the columns ‘SCRAP’ and ‘MATERIAL GROUP DESC’ I want to visualize the sum of ‘SCRAP’ per ‘MATERIAL GROUP DESC’
So I do following:
chart = Bar(df_rolling,values=‘SCRAP’,label=‘MATERIAL GROUP DESC’,agg=‘sum’,width=1250)
show(chart)
which gives me almost the result that I want. The problem is that I can’t find a way to sort it from higher to lower values of ‘SCRAP’.
For example with pandas I would do the following:
roll_chart = pd.pivot_table(df_rolling,values=[‘SCRAP’], index=‘MATERIAL GROUP DESC’, aggfunc=‘sum’)
roll_chart = roll_chart.sort_values(by=‘SCRAP’,ascending=False)
chart = roll_chart.plot(kind=‘bar’)
And that would give me the desired result.
So, how can I do the same thing with bokeh?
I read all relating threads but still can’t figure it out. Please forgive my lack of experience.
Thanking you in advance for your imput,
PZ