Twitter Data Analysis
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.