This Python script generates an interactive dashboard to visualize statistics from your Twitter data.
- Automatically converts your Twitter data export (tweets.js) to a CSV file
- Displays tweet activity over time
- Shows average engagement (likes and retweets) over time
- Visualizes tweet frequency by hour of the day
- Presents a scatter plot of likes vs. hour to identify "banger" tweets
- Generates a word cloud from your tweet content
- Python 3.7+
- pip (Python package installer)
-
Clone this repository or download the
tweet_stats.pyfile. -
Install the required Python packages:
pip install pandas plotly dash wordcloud
-
Export your Twitter data and locate the
tweets.jsfile. -
Create a
datafolder in the same directory astweet_stats.py. -
Place your
tweets.jsfile in thedatafolder. -
Run the script:
python tweet_stats.py -
Open a web browser and go to
http://127.0.0.1:8050/to view your dashboard.
- The script first checks for a
tweets.csvfile in thedatafolder. - If
tweets.csvdoesn't exist, it looks fortweets.jsand generates the CSV file. - The data is then processed and used to create various visualizations.
- A Dash app is created to display these visualizations in an interactive dashboard.
You can modify the script to change the appearance of the graphs or add new visualizations. Look for the callback functions in the script to adjust existing graphs.
- If you encounter a
FileNotFoundError, make sure yourtweets.jsfile is in thedatafolder. - For other issues, ensure you have all the required packages installed and are using a compatible Python version.
This script runs locally on your machine and does not send your data anywhere. However, always be cautious with your personal data and avoid sharing the generated dashboard publicly.
This project is open source and available under the MIT License.