
background_color : To set a background_color.The random_state parameter has to be an integer value. random_state : To recreate the same plot every time we run the function.width/height : To adjust the height and width of the wordcloud.The WordCloud function provides a lot of parameters that we can tweak according to our desire. Now, we have reached the important step of creating the wordcloud! We can generate the wordcloud in the following manner. Text = " ".join(cat for cat in df.Review) This can be done using the join function available in python. The next step is to generate a text variable which contains all the reviews combined as a single string. The 'Review' column is the actual review written by the customer and the 'Liked' column is a binary variable which states whether or not the customer liked the food. The data contains two columns namely 'Review' and 'Liked'. Now, let us read the data as a dataframe using pandasĭf = pd.read_csv("Restaurant_Reviews.tsv", sep=" ") To begin with, we will firstly have to import the necessary libraries.įrom wordcloud import WordCloud, STOPWORDS In this tutorial, we will be using the Restaurant reviews data from kaggle. They are numpy (for array manipulation), pillow (for image handling), matplotlib (for generating plots) and finally wordcloud (for generating wordclouds). In order to work with wordclouds in python, we will first have to install a few libraries using pip. Wordcloud is basically a visualization technique to represent the frequency of words in a text where the size of the word represents its frequency.



In this tutorial, let us understand how to generate wordclouds in python! Yes you read it right.
