Hi, I have two fields I want plotted on a bar chart, a date field (‘Inbound Date’) and the count of inbound leads.
I want to show the counts in terms of months on the bar chart, however when I try to plot this, I just get a bar chart of all the dates (understandably). I think then tried to create another column translating the date to the Month Name. I then tried to plot the month name and the aggregated counts, however the x axis ordered the months alphabetically when I need them ordered by calendar month.
Here is my code. Is there anyway I can plot the dates but have them shown as month aggregates? Or a way where I can change the order of the x axis if I plot the Month column instead?
df_sv = df.copy() df_sv = df_sv.groupby(['Inbound Date', 'Business Type'], as_index=False).count() df_sv = df_sv.sort_values(by='Inbound Date', ascending=True) types = ['HVAC', 'Family Law'] data =  for x in types: df_aux = df_sv[df_sv['Business Type']==x] data.append( go.Bar( x=df_aux['Inbound Date'], y=df_aux['Quarter'], name = x ) ) layout = go.Layout( xaxis = dict( tickformat= '%b' ) ) fig = go.Figure(data = data, layout = layout) py.iplot(fig, filename='basic-bar')