Created
May 3, 2019 20:04
-
-
Save karamanbk/01623d1449e9aff02c0ea5d10e52a112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get order counts for each user and create a dataframe with it | |
tx_frequency = tx_uk.groupby('CustomerID').InvoiceDate.count().reset_index() | |
tx_frequency.columns = ['CustomerID','Frequency'] | |
#add this data to our main dataframe | |
tx_user = pd.merge(tx_user, tx_frequency, on='CustomerID') | |
#plot the histogram | |
plot_data = [ | |
go.Histogram( | |
x=tx_user.query('Frequency < 1000')['Frequency'] | |
) | |
] | |
plot_layout = go.Layout( | |
title='Frequency' | |
) | |
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