8. Sentiment Analysis
Activity 13: Tweet Sentiment Analysis Using the TextBlob library
Let's perform sentiment analysis on tweets related to airlines. Follow these steps to implement this activity:
- Open a Jupyter notebook.
- Insert a new cell and add the following code to import the necessary libraries:
import pandas as pd from textblob import TextBlob import re
- Since we are displaying the text in the notebook, we want to increase the display width for our DataFrame. Insert a new cell and add the following code to implement this:
- Now we load the
Tweets.csvdataset. From this dataset, we are only fetching the "
text" column. Thus, we need to mention the "
text" column name as the value for the
usecolsparameter of the
read_csv()function. The fetched column is later being replaced to a new column named "
Tweet". Insert a new cell and add the following code to implement...