'How do I create a barchart showing my results from k-means clustering?

I've used k-means clustering to cluster the words in a dataframe of poems and assign each row (containing a poem) to a predicted cluster. My results can be seen in the dataframe here:

enter image description here

I'd like to put these results into a barchart using matplotlib. The x-axis would be the predicted clusters and the y axis would be the number of rows/poems attributed to that cluster.

Here is a snippet of the code I used to predict each cluster:

# Create an instance of KMeans to find k clusters
data = poems.copy(deep=True)
k=15 # Choose 9 clusters
kmeans_poems_all = KMeans(n_clusters=k,random_state=2)

#Use fit_predict to cluster the dataset
predict_cluster = kmeans_poems_all.fit_predict(X)

# Add a column to the df for cluster membership
data['Cluster'] = predict_cluster

data.head()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source