How To Create A Word Cloud In Python
Language:
In this tutorial, I will show you, how to create a Word Cloud in Python by using the library called “wordcloud”.
📝 Resources:
Link to word cloud library documentation: https://amueller.github.io/word_cloud/
You can download the code & excel files for free here:
Download Here
👩💻 Source Code:
import matplotlib.pyplot as plt from wordcloud import WordCloud, STOPWORDS import sys, os os.chdir(sys.path[0]) # Read text text = open('jeff_bezos_speech.txt', mode='r', encoding='utf-8').read() stopwords = ['choice', 'will'] wc = WordCloud( background_color='white', stopwords=stopwords, height = 600, width=400 ) wc.generate(text) # store to file wc.to_file('wordcloud_output.png')