Created
May 3, 2019 20:07
-
-
Save karamanbk/ec8526800ff475419ee9054484400d21 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
#k-means | |
kmeans = KMeans(n_clusters=4) | |
kmeans.fit(tx_user[['Frequency']]) | |
tx_user['FrequencyCluster'] = kmeans.predict(tx_user[['Frequency']]) | |
#order the frequency cluster | |
tx_user = order_cluster('FrequencyCluster', 'Frequency',tx_user,True) | |
#see details of each cluster | |
tx_user.groupby('FrequencyCluster')['Frequency'].describe() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment