Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/instagram.py Secret

Created Jan 26, 2021
Embed
What would you like to do?
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS
stopwords = set(STOPWORDS)
stopwords.add('will')
import re
import seaborn as sns
sns.set()
plt.style.use('seaborn-whitegrid')
def WordCloudPlotter(dfColumn):
colData = data[dfColumn]
textCloud = ''
#text processing
# converting colums to a
#single line of text
for mem in colData:
textCloud = textCloud + str(mem)
# plotting word cloud
wordcloud = WordCloud(width = 800, height = 800,background_color ='white',
stopwords = stopwords, min_font_size = 10).generate(textCloud)
plt.figure(figsize = (8, 8), facecolor = None)
plt.style.use('seaborn-whitegrid')
plt.imshow(wordcloud)
plt.rcParams.update({'font.size': 25})
plt.axis("off")
plt.title('Word Cloud: ' + str(dfColumn))
plt.tight_layout(pad = 0)
plt.show()
WordCloudPlotter('Caption')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment