As a data analyst, you need to identify the most frequent words and represent them in graphical form to the top management. A word cloud is used to represent a word-frequency plot. It represents the frequency by the size of the word, that is, the more frequent word looks larger in size and less frequent words looks smaller in size. It is also known as a tag cloud. We can create a word cloud using the wordcloud library in Python. We can install it using the following commands:
pip install wordcloud
Or, alternatively, this one:
conda install -c conda-forge wordcloud
Let's learn how to create a word cloud:
- Import libraries and load a stopwords list:
# importing all necessary modules
from wordcloud import WordCloud
from wordcloud import STOPWORDS
import matplotlib.pyplot as plt
stopword_list = set(STOPWORDS)
paragraph="""Taj Mahal is one of the beautiful monuments. It is one of the wonders of the world. It was built by Shah Jahan in 1631 in memory of...