Skip to content

Instantly share code, notes, and snippets.

@karamanbk
Created May 3, 2019 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karamanbk/5237238ffc483308c076642c26c41c4d to your computer and use it in GitHub Desktop.
Save karamanbk/5237238ffc483308c076642c26c41c4d to your computer and use it in GitHub Desktop.
# create a new dataframe for average revenue by taking the mean of it
tx_monthly_order_avg = tx_uk.groupby('InvoiceYearMonth')['Revenue'].mean().reset_index()
#print the dataframe
tx_monthly_order_avg
#plot the bar chart
plot_data = [
go.Bar(
x=tx_monthly_order_avg['InvoiceYearMonth'],
y=tx_monthly_order_avg['Revenue'],
)
]
plot_layout = go.Layout(
xaxis={"type": "category"},
title='Monthly Order Average'
)
fig = go.Figure(data=plot_data, layout=plot_layout)
pyoff.iplot(fig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment