Twitter Data Analysis

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.Β Β 

The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

 

 

 

 

About Author

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans 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 boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis 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 seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI