Twitter Data Analysis
After creating the Free Wtr bot using Tweepy and Python and this code, I wanted a way to see how Twitter users were perceiving the bot and what their sentiment was. So I created a simple data analysis program that takes a given number of tweets, analyzes them, and displays the data in a scatter plot.
Setup
I had to install a few packages to create this: Tweepy, Tkinter, Textblob and matplotlib. You can install each of these with the pip package manager. For example:
pip install tweepy
or you can clone into the Github repository like this.
git clone https://github.com/sloria/textblob
cd textblob
python setup.py install
Next you will need to create a new Python file and import the following packages.
import tweepy #The Twitter API
from Tkinter import * #For the GUI
from time import sleep
from datetime import datetime
from textblob import TextBlob #For Sentiment Analysis
import matplotlib.pyplot as plt #For Graphing the Data
Twitter Credentials
Now we need to link a Twitter account to our script. If you don’t have one already, create one.
Go to apps.twitter.com and sign in with your account. Create a Twitter application and generate a Consumer Key, Consumer Secret…