Twitter Data Analysis

Avatar
Posted on Nov 25, 2020

Social Media is widely used across the world, people are constantly posting about different events and their opinions of those events. Social Media is a gold mine for information since it can provide a lot of insight into what people are thinking and their beliefs. Twitter is one of the most used social media platforms with over 140 million~  active users every day.

2020 has been an interesting year, and it is also the year for the presidential election. I decided to use the Twitter dataset to analyze how peoples opinions of the candidates changed throughout the election process.

Data

First, to have an understanding of how many tweets there were every day. The original dataset was split into four different RDDs. Two of them were filtering using "trump " and the other "biden ". Then 2 more RDDs were created by filtering out the retweets from the "trump" and the "biden" RDDs.

Tweets mentioning Trump had a peek on Oct. 23 (13.194k ), Nov. 4(26.222k) and remained very active until  Nov. 7(23.44k)

 

Tweets mentioning Biden had a peek on Oct. 23(11.138k), Nov. 4(15.051k), and Nov. 7 (19.305k)

 

These results were to be expected since Oct. 23, and Nov. 4 were a day after a significant event, the 3rd presidential debate and election day.

Retweets

Retweets mentioning Trump had a peek on Oct. 23 (8355), and Nov. 4(16.094k)

 

Retweets mentioning Biden had a peek on Oct. 23(7697), Nov. 4(9662), and Nov. 7(12.712k)

 

 

Most of the tweets mentioning either candidate are just retweets.

TF-IDF

Doing TF-IDF on the Twitter data and treating each individual tweet as an entity would not provide very interesting results since tweets don't contain a lot of words. So in order to get more interesting results, all the tweets in a day were treated as one singular tweet.

Also, since there is 43 days worth of data. I will be posting the results for the days with the most tweets.

Trump Tweets

Biden Tweets

There is a couple of identical results in both of them. 'debate2020' on Oct. 23,  and 'electionnight' on Nov. 4.

Interesting Data

Starting from the 318th day of 2020 (Nov. 13) tweets mentioning Biden have been posting the day of the month. 322nd (Nov. 17), 323rd (Nov. 18), 324th (Nov. 19). Which I found very interesting. 

Conclusion

I was able to obtain very interesting results, but there is still more that could be done with this data. For example, for some words that scored high on the TF-IDF, a filter could return all the original tweets that included that word. Also, a TF-IDF could be run on the retweets to see how different tweets and retweets were.

But something that could potentially improve the results is having a word dictionary that included names, and using that dictionary to filter out all garbage from the tweets.  

 

 

 

 

About Author

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp