DOI: 10.6084/m9.figshare.24289102.v1
title: Analyzing geospatial election prediction: The influence of COVID-19 on social media discourse

description: <b>C</b><b>ode</b>This figshare repository hosts a collection of tools and scripts for Twitter data analysis, focusing on Election Prediction using sentiment analysis and tweet processing. The repository includes four key files:<b>twitter_data_collection.py</b>: This Python script is designed for collecting tweets from Twitter in JSON format. It provides a robust method for gathering data from the Twitter platform.<b>EP.ipynb</b>: EP.ipynb" is designed for sentiment analysis and tweet processing. It features three sentiment analysis methods: VADER, BERT, and BERTweet. It includes a US states dictionary for geolocating and categorizing tweets by state, providing sentiment analysis results in both volumetric and percentage formats. Furthermore, it offers time-series analysis options, particularly on a monthly basis. It also includes a feature for filtering COVID-19-related tweets. Additionally, it conducts election analysis at both state and country levels, giving insights into public sentiment and engagement regarding political elections.<br><br><b>Dataset</b><b>biden and trump.csv Files:</b>The "biden.csv" and "trump.csv" files together constitute an extensive dataset of tweets related to two prominent U.S. political figures, Joe Biden and Donald Trump. These files contain detailed information about each tweet, including the following key attributes:create_date: The date the tweet was created.id: A unique identifier for each tweet.tweet_text: The actual text content of the tweet.user_id: The unique identifier for the Twitter user who posted the tweet.user_name: The name of the Twitter user.user_screen_name: The Twitter handle of the user.user_location: The location provided by the user in their Twitter profile.state (location): The U.S. state associated with the user's provided location.text_clean: The tweet text after preprocessing, making it suitable for analysis.Additionally, sentiment analysis has been applied to these tweets using two different methods:VADER Sentiment Analysis: Each tweet has been assigned a sentiment score and a sentiment category (positive, negative, or neutral) using VADER sentiment analysis. The sentiment scores are provided in the "Vader_score" column, and the sentiment categories are in the "Vader_sentiment" column.BERTweet Sentiment Analysis: The files also feature sentiment labels assigned using the BERTweet sentiment analysis method, along with associated sentiment scores. The sentiment labels can be found in the "Sentiment" column, and the cleaned sentiment labels are available in the "Sentiment_clean" column.This combined dataset offers a valuable resource for exploring sentiment trends, conducting research on public sentiment, and analyzing Twitter users' opinions related to Joe Biden and Donald Trump. Researchers, data analysts, and sentiment analysis practitioners can utilize this data for a wide range of studies and projects.This repository serves as a resource for collecting, processing, and analyzing Twitter data with a focus on sentiment analysis. It offers a range of tools and datasets to support research and experimentation in this area.