Importing Libraries and Datasets
The libraries used are :
- Pandas : For importing the dataset.
- Scikit-learn : For importing the model, accuracy module, and TfidfVectorizer.
- Warning : To ignore all the warnings
- Matplotlib : To plot the visualization. Also used Wordcloud for that.
- Seaborn : For data visualization.
Python3
import warnings warnings.filterwarnings( 'ignore' ) import pandas as pd import re import seaborn as sns from sklearn.feature_extraction.text import TfidfVectorizer import matplotlib.pyplot as plt from wordcloud import WordCloud |
For text analysis, we will be using NLTK Library. From that we will be requiring stopword. So let’s download and import it using the below command.
Python3
import nltk nltk.download( 'stopwords' ) from nltk.corpus import stopwords |
After that import the downloaded dataset using the below code.
Python3
data = pd.read_csv( 'flipkart_data.csv' ) data.head() |
Output :
Flipkart Reviews Sentiment Analysis using Python
This article is based on the analysis of the reviews and ratings user gives on Flipkart to make others aware of their experience and moreover about the quality of the product and brand. So, by analyzing that data we can tell the users a lot about the products and also the ways to enhance the quality of the product.
Today we will be using Machine Learning to analyze that data and make it more efficient to understand and prediction ready.
Our task is to predict whether the review given is positive or negative.
Before starting the code, download the dataset by clicking this link.
Contact Us