Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/IPL Secret

Created Sep 23, 2020
Embed
What would you like to do?
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
text = " ".join(str(bowlertobat) for bowlertobat in CSK["postText"])
text = text.join(str(bowlertobat) for bowlertobat in CSK["preText"])
stopwords = set(STOPWORDS)
stopwords.update(["nan","see","us","br","till","felt", "hit","now","came", "match","back","one" "the","pick","end","sure","got","ball","still","overall","need","will","player","day","thing"])
#print(text)
# Create and generate a word cloud image:
wordcloud_csk = WordCloud(collocations=False,stopwords=stopwords,max_font_size=80, max_words=100, background_color="yellow").generate(text)
text = " ".join(str(bowlertobat) for bowlertobat in MI["postText"])
stopwords = set(STOPWORDS)
stopwords.update(["nan","see","us","br","till","overs","felt", "hit","now","came","blank","match","back","one" "the","pick","end","sure","got","ball","still","overall","need","will","player","day","thing"])
#print(text)
# Create and generate a word cloud image:
wordcloud = WordCloud(collocations=False,stopwords=stopwords,max_font_size=80, max_words=100, background_color="#6098bf").generate(text)
fig, (ax1, ax2) = plt.subplots(1, 2,figsize=(15,15))
#fig.suptitle('Horizontally stacked subplots')
ax1.imshow(wordcloud_csk, interpolation='bilinear')
ax1.axis("off")
ax2.imshow(wordcloud, interpolation='bilinear')
ax2.axis("off")
fig.tight_layout(pad=3.0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment