
Summary
As the 2020 US election aftermath draws to a close, we analyzed Twitter sentiments surrounding the two presidential candidates (one of them the president elect). The goal was to find out what meaningful conclusions about what the future might hold for the 2nd Amendment under the administration that takes the Oval Office for the next four years.
Presumably, that administration will be headed by president elect Biden. But we’ve given time to thinking about what a Trump administration might look like, since the results aren’t confirmed, yet.
In a Nutshell
- Joe Biden's administration has laid out an aggressive plan for gun control, which includes firearm and magazine registration, among other things.
- A Donald Trump win might have resulted in an administration that placed less emphasis on pursuing a gun control agenda, though it certainly wouldn’t be a pro-gun administration.
- Regardless of who takes office in January, it’s most likely the 2nd amendment will suffer as a result
- The number of times Donald Trump has been the topic of discussion, tagged, hash-tagged, mentioned or quoted is astonishingly 2.5x higher than Joe Biden (30 million vs 8 million).
- Joe Rogan (control) has the most positive sentiment overall followed by Biden
- Donald Trump is involved in least positive conversation on Twitter
- The sentiment for Donald Trump and Joe Rogan has been going up over time, while for Biden, it has been declining
- The trends for discussing the presidential candidates are correlated and follow the same trends, although at different values
- All 3 have approx. the same breakdown of positive and negative tweets: around 19% being positive, around 35% being negative, and around 45% being neutral
- Tweets about candidates tend to start from early afternoon and stretch late into the night with the peaks between 3 – 6 pm.
Introduction
Twitter in today’s modern tech-enabled world is ubiquitous. It is a data scientist’s gold mine and helps compile valuable real-world data and sentiments from a source where conversations about all topics worldwide take place in real-time.
Using this, we wanted to undertake a study to see what trends and sentiments we can make out for the current US Elections’ Presidential Candidates and how that would translate to gun control later, if at all. Overall, more than 40 million tweets were collected, segregated and categorized. There were several interesting observations that we made.
When it came to generating conclusions from the data, our view was that Twitter sentiment revealed something about how people feel about the presidential candidates and their policies.
Political administrations rely heavily on social media for gauging public opinion. So it stands to reason that more positive sentiment on Twitter might lead an administration to more doggedly pursue a course of action, since it will appear to them that it’s what their constituents want.
However, it’s worth noting that there are a lot of people who do not express their opinions on social media. So this analysis isn’t about what people in the United States believe on the whole. We’re looking at how a presidential administration might perceive what people in the United States believe, given that they lean heavily on social media to gauge public opinion.
Finally, we used “Joe Rogan” as a baseline for the study. He is a person who is heavily involved in and around the presidential conversation and receives significant clout, but is not a presidential candidate.
TECHNOLOGIES EMPLOYED
Methodology

- Data Collection – First, we needed to collect the data. This was accomplished using a Python Library called Twint. Twint employs Twitter’s frontend API which is the end consumer facing tool. We also used Twitter’s official API which is a backend API. The main advantage is that using the frontend API bypasses the limits of roughly 3200 tweets per API call, including the rate limit applied on the account API key. It does this by using several different libraries such as Beautiful Soup under the hood.
- Text Preparation – Second, the data collected from the first step needed to be filtered and sanitized. Also, during data scraping, we found that the tool could not export the data in .csv format due to issues in the library itself. Due to this all data was exported as plain text (.txt) and then converted to csv using a delimiter. Other steps involved in preparation were:
- Sentiment Detection – TextBlob comes with its own pre-trained corpora for sentiment analysis. Using this it gives a score between -1 and +1 to each piece of text. Values greater than 0 indicate a positive sentiment and vice versa. It also gives a subjectivity score to indicate whether the text is fact-based or emotion-based. So, this step involved iterating over each tweet and storing its sentiment polarity and subjectivity scores.
- Sentiment Classification – All tweets were categorized as Positive, Neutral or Negative based on their polarity value. Positive => Polarity > 0, Neutral => Polarity = 0, Negative => Polarity < 0
- Presentation of Output – The online solution of Plotly Public was used to plot all the data and trends using Chart Studio stacked bar graphs, line graphs and tables.
Total Tweets by Topic
This graph plots the total number of tweets between September 5th 2020 and October 19, 2020 for the topics (“Donald Trump,” “Joe Biden,” and “Joe Rogan”).
“Donald Trump” was overwhelmingly the most talked about, with over 30 million tweets over this period. It’s clear that Donald Trump was the most talked-about figure on Twitter prior to the elections. Now, the volume of tweets doesn’t show exactly what people think of each candidate and their policies.
However, the huge volume of tweets about Donald Trump suggests that he might be more easily swayed by public sentiment on social media, since any positive or negative reaction to Trump’s policies will seem much more severe than reactions to the other two figures.
On the other hand, Joe Biden might be more inclined to pursue an unpopular course of action—such as gun control—in the face of negative sentiment. There simply may not be enough volume of negative feedback to affect the plotted course of a Biden administration.
Tweets Over Time
In this graph we plotted the tweets’ count over the same period.
As expected, the tweets mentioning Donald Trump far exceeded the others on a daily basis. There was a noticeable increase in the tweets on Mr. Trump from 2nd October to 13th October. This may be further analyzed by mapping any news or election campaign activities related to him during this period of time.
In short, whenever there was a significant effort from the campaigners (regardless of party affiliation), the number of tweets on those dates followed suit. Meaning the number of tweets during important campaigning dates is significantly larger than the number of tweets during dates when there was less aggressive or no campaigning at all.
The conclusion that we can draw from this is that there is more public awareness surrounding Donald Trump’s decisions. Whether people react positively or negatively, they are seeing what he does and responding to it.
That means that anything Trump’s administration does will be heavily scrutinized.
On the other hand, Biden seems to get less attention with his activities and campaigns. That dovetails nicely into the data on tweet volumes. However, there’s an additional aspect to this data.
The lower response to Joe Biden’s campaigning and journalistic exposure could also mean that a Biden administration may have an easier time quietly passing unpopular legislation without getting much backlash over it.
Tweet Sentiment By Percentage and Topic
In this visual, we studied the overall positivity and negativity of each topic expressed individually as a percentage of the total number of tweets of the topic.
With this, we can observe that Joe Rogan has the most positive tweets by a significant margin (which is unsurprising, given that podcasting is a less polarizing activity than politics). On the other hand, the number of negative tweets is almost the same across the board for all three topics.
This is possibly the most valuable data point from the entire data set.
Biden has a higher percentage of positive sentiment tweets. However, Trump simply has more tweets about him in total.
That indicates that Biden’s policies are likely to get more support from his base. But Trump gets a far higher volume of tweets, overall. Even though a lower percentage of tweets about Trump are positive, there are more people that seem to favor Trump’s policies, in terms of absolute numbers.
This suggests that Biden’s policies might be less popular, overall. But, since opposition to Biden’s policies is likely wrapped up in tweets about Trump, a Biden administration is unlikely to be sensitive to policy critiques from social media.
However, this phenomenon might be asymmetrical. Negative responses are likely to get more attention from a Trump administration. Since Trump gets such a high volume of tweets, even a small percentage of negative tweets could translate to a lot of negative sentiment, in terms of absolute numbers.
This could be problematic from a 2nd Amendment perspective. Millions of people became new gun owners this year. But a Biden administration may be unresponsive to their voices on social media, because there simply won’t be as many critical voices on social media.
So any negative sentiment about gun control policies may be perceived as a small, fringe portion of his voter base, when that may not be the case.
Donald Trump Sentiment Over Time
In this visual, we plotted the sentiment polarity score of the gathered tweets. We calculated the above using a simple average per day method and plotting it over time. We overlaid a straight line of fit for the dataset to understand the overall trend. We found that there was a clear upward trend in the sentiment related to Donald Trump.
This is interesting because it suggests one of two things:
- Donald Trump supporters on Twitter are becoming more active.
- Support for Trump is actually increasing.
Either way, this upward trend suggests that at least some of Trump’s policies might be more popular here at the (potential) end of his presidency than they were at the start.
The long-term implications of this rising sentiment are that Biden may decrease his chances of reelection (assuming the election results are confirmed) by enacting policies that are drastically different than Trump’s policies. And, given that Biden could be unresponsive to social media critiques of his policies, it’s entirely possible that a Biden administration may take a hard line in the opposite direction from the Trump administration.
In short, the rise in positive sentiment leading up to the election could mean that Biden will be a single term president, if he pursues policies that are too aggressively against Trump’s agenda.
Joe Biden Sentiment Over Time
Here we plotted the sentiment polarity score of tweets calculated using a simple average per day method and plotting it over time. A straight line of fit for the dataset was overlaid to understand the overall trend. We found that there was a slight downward trend in the sentiment related to this topic.
This downward trend acts as some confirmation of the previous conclusion about Biden being a single term president.
Presidential campaigns release more plans for the next four years as the election draws near. This downward trend in sentiment for Joe Biden suggests that Biden’s policies may be less popular than expected.
Joe Rogan Sentiment Over Time
In this study, we plotted the sentiment polarity score of tweets calculated using a simple average per day method and plotting it over time. A straight line of fit for the dataset was overlaid to understand the overall trend. We found that there was a clear upward trend in the sentiment related to this topic.
The control data set for Joe Rogan offers some additional insight into the conclusion about what’s going on with Joe Biden’s declining sentiment.
Joe Rogan is a far less polarizing figure than either Donald Trump or Joe Biden, because Joe Rogan is not a completely political figure. Joe Rogan’s reputation is that he produces interesting content.
So, at least in theory, Joe Biden’s sentiment should go up—or at least remain stable—if he’s saying things that are merely interesting or neutral. The fact that his sentiment is declining suggests that he might be publicizing opinions and policies that are significantly unpopular.
Donald Trump - A Sample Set of Positive Tweets
A set of positive tweets from the dataset.
Donald Trump - A Sample Set of Negative Tweets
A set of negative tweets from the dataset.
Joe Biden - A sample Set of Positive Tweets
A set of positive tweets from the dataset.
Joe Biden - A sample Set of Negative Tweets
A set of negative tweets from the dataset.
Joe Rogan - A Sample Set of Positive Tweets
A set of positive tweets from the dataset.
Joe Rogan - A Sample Set of Negative Tweets
A set of negative tweets from the dataset.
Donald Trump – Tweets by Time of Day
In this plot, we used the timestamp of each tweet to extract the hour of the day (24 hour format) when it was tweeted and plotted the frequency on a bar graph.
Here 0 represents 12:00 am while 15 represents 3:00 pm. All tweets within an hour were mapped to the last hour. So a tweet at 10:15 am will be counted in 10.
Joe Biden – Tweets by Time of Day
In this plot, we used the timestamp of each tweet to extract the hour of the day (24 hour format) when it was tweeted and plotted the frequency on a bar graph.
Here 0 represents 12:00 am while 15 represents 3:00 pm. All tweets within an hour were mapped to the last hour. So a tweet at 10:15 am will be counted in 10.
Joe Rogan – Tweets by Time of Day
In this visual, we used the same method as in the two other datasets above.
Not surprisingly, all tweets for all three topics (Donald Trump, Joe Biden, and Joe Rogan) have been following the same posting pattern, regardless of tweet volume.
Average Polarity Comparison
This table summarizes the average polarity of each topic over the period of the study.
Again, the polarity ranges from +1 to -1, with +1 being MOST positive and -1 being LEAST positive. Joe Rogan is closest to +1, meaning tweets that include this topic have the most positive polarity on Twitter, followed by Joe Biden and Donald Trump (least positive) respectively.
In other words, Joe Rogan is most liked on Twitter, Donald Trump is least liked on Twitter, and Joe Biden lands somewhere in the middle between these two topics out of all three.
This data set might be a bit deceiving. Here’s why:
People tend to be moderately positive when they post positive tweets. Just check out the positive and negative tweets above.
However, negative tweets tend to be incredibly hostile, especially in relation to Donald Trump. This may skew the overall sentiment analysis downward, even if the absolute number of positive tweets is higher.
But there’s an additional takeaway here. If there’s anything that Donald Trump did very well, it was manipulate the media and influence people’s opinion of him. That influence may have made people think worse of him. But the influencing happened.
Being right in the middle in terms of overall sentiment suggests that Biden isn’t particularly attention getting. Most of the time, he’s either not expressing particularly attention getting opinions. Or Biden is not presenting his policies and opinions in a way that really gets a reaction from people.
This could enhance Biden’s ability to dodge scrutiny. But it might also exacerbate the potential that he does not win a second term, since it might seem like he didn’t do anything memorable during his four years in office.
The economic, social, and political climate will undoubtedly be different in 2024. Being forgettable might be a benefit in the next election. But as it stands right now, it could be a bad thing if people perceive that you didn’t do anything during your presidency.
Ultimately, the thing that’s enabling Biden to sort of fly under the radar right now, might be a glaring weakness in four years.
Sentiment Comparison Over Time
This graph combines the earlier individual line graphs of sentiment over time by topic in one.
Conclusion
By now, we at least have some idea of who won the election. Our assertion is that the situation for the 2nd Amendment will get worse, regardless of who takes the Oval Office in January.
Despite claims of being a pro 2A candidate in 2016, Trump issued the executive ban on bump stocks. And some of the most aggressive gun legislation in recent memory was introduced during his presidency.
Clearly, the Trump administration is not a reliable deterrent against pushes for gun control.
Of course, a Biden presidency is even less of a bulwark for the 2nd Amendment, especially considering how brazen the ATF has been in advancing further NFA regulations, despite the Trump administration’s opposition to such measures. A democratic presidency would essentially unchain the ATF to run wild over the next four years.
Additionally, the Biden administration could be especially deaf to the voices of gun owners—both new and experienced—because their social media radar may present an image that underrepresents pro-2A sentiment.
Ultimately, there will be more calls for stricter gun legislation, regardless of how last night’s election shook out. Sadly, even if republicans occupy a majority in the house and the senate, many republican congresspeople and senators have shown very little fortitude in protecting the 2nd Amendment.
Given the even distribution of positive, negative, and neutral sentiment between the two candidates, it seems that most Americans mirror our belief that there is no safe 2020 election result for the 2nd Amendment.
Since no president provides a safe space for gun rights, it’s up to the people to protect our own 2nd Amendment rights.
Support organizations like the Firearms Policy Foundation (set up your Amazon Smile account to donate to the Firearms Policy Foundation every time you make a purchase) and the 2A Foundation. Or support improving and rebuilding the NRA, if you prefer.
But do what you can to take protecting the 2nd Amendment into your own hands. The biggest mistake any 2A supporter can make is to believe that we can rest easy under any president, because gun control will never be dead.
Our conclusion is that there will be more gun regulation placed on the table, no matter who takes up the presidency in January. And it’s up to us, here on the ground, to do something about that.