How to create a wordcloud and what is it helpful for Explain with an example?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

How to create a wordcloud and what is it helpful for Explain with an example?

How to create a wordcloud and what is it helpful for Explain with an example?

This recipe helps you create a wordcloud and what is it helpful for Explain with an example

0

Recipe Objective

How to create a wordcloud and what is it helpful for?

Wordcloud is nothing but a data visualization technique mainly used for text representation it is also called a tag cloud. In this, the size of each word indicates its frequency or importance of that word. It displays a list of words, the importance of each is shown by font color or size.

What is it useful for: Analyzing text data from social media websites. Significant textual points can be highlighted using a word cloud. In a Customer service process useful to analyze customer feedback. Identifying new SEO(Search engine optimization) Keyword to target. And Many More...

Step 1 - Install Wordcloud

!pip install wordcloud

Step 2 - Import the necessary libraries

from wordcloud import WordCloud, STOPWORDS import matplotlib.pyplot as plt import pandas as pd

Step 3 - Take a sample data set

df_sample = pd.read_csv('/content/Youtube_Comments_data.csv', encoding ="latin-1") df_sample.head()

For sample data we are using youtube comments data on videos of famous artist.

Step 4 - Store comments in a simple string and stopwords in a variable

words_comments = '' My_stopwords = set(STOPWORDS)

Step 5 - Iterate through the Sample data.

for elements in df_sample.CONTENT: elements = str(elements) tokenization = elements.split() for i in range(len(tokenization)): tokenization[i] = tokenization[i].lower() words_comments = words_comments + " ".join(tokenization)+" "

Here in the above in first for loop we are firstly typecasting the each element into string then splitting the values. After that in the second for loop we are converting each value into lower case.

Step 5 - Create wordcloud for visualization

My_wordcloud = WordCloud(width = 800, height = 800, background_color ='white', stopwords = My_stopwords, min_font_size = 10).generate(words_comments)

Step 6 - Plot the cloud Image

plt.figure(figsize = (8, 8), facecolor = None) plt.imshow(My_wordcloud) plt.axis("off") plt.tight_layout(pad = 0) plt.show()

Relevant Projects

Data Science Project on Wine Quality Prediction in R
In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

Walmart Sales Forecasting Data Science Project
Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Predict Credit Default | Give Me Some Credit Kaggle
In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

Ensemble Machine Learning Project - All State Insurance Claims Severity Prediction
In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

Data Science Project - Instacart Market Basket Analysis
Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

Time Series Forecasting with LSTM Neural Network Python
Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.