Skip to content

Latest commit

 

History

History
52 lines (29 loc) · 1.98 KB

README.md

File metadata and controls

52 lines (29 loc) · 1.98 KB

twitter_sentiment_challenge

Twitter Sentiment Analysis Challenge for Learn Python for Data Science #2 by @Sirajology on Youtube

Overview

This is the code for the Twitter Sentiment Analyzer challenge for 'Learn Python for Data Science #2' by @Sirajology on YouTube. The code uses the tweepy library to access the Twitter API and the TextBlob library to perform Sentiment Analysis on each Tweet. We'll be able to see how positive or negative each tweet is about whatever topic we choose.

Dependencies

Install missing dependencies using pip

Usage

Once you have your dependencies installed via pip, run the script in terminal via

python demo.py

Challenge

Instead of printing out each tweet, save each Tweet to a CSV file with an associated label. The label should be either 'Positive' or 'Negative'. You can define the sentiment polarity threshold yourself, whatever you think constitutes a tweet being positive/negative. Push your code repository to github then post it in the comments. I'll give the winner a shoutout a week from now!

Credits

This code challenge is given by Siraj and challenge completed by Tirth


Challenge Completed

Process

To save the tweets with it polarity in csv:

Get the public tweets

Make a row in csv file with label "Tweets and Polarity"

Perform the sentiment analysis on tweets and store it in variable

Csv file does not support write column operation, therefore store the tweets with its polarity in variable

Zip the collected tweets with its polarity. Zip perform row to column operation

Write the stored zip into csv

Done