Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/IPL Secret

Created September 23, 2020 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/696521f5ea7826145888e7a3bec1b5ea to your computer and use it in GitHub Desktop.
Save amankharwal/696521f5ea7826145888e7a3bec1b5ea to your computer and use it in GitHub Desktop.
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