Skip to content

kublasean/nba-twitter-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nba-twitter-analysis

Making graphs of player-player connections on twitter

Requires:

Usage:

First, both get_verts.py and get_edges.py import get_auth.py where you'll need to put in your twitter developer credentials. If you don't know what this means, check out this walkthrough.

# returns twitter api
# (this codeblock is in both get_auth.py files)
def getAPI():
    api = twitter.Api(consumer_key="",
                  consumer_secret="",
                  access_token_key="",
                  access_token_secret="")
    api.sleep_on_rate_limit = True
    return api

Run get_verts.py on a set of twitter names to search for these names and output a list of verified twitter ids and attributes in a .csv output file. Any .csv input file with whatever you want to search for per user as the first column will work. Extra columns will be preserved in the output file. Then, to find the all edges between vertices in this set run get_edges.py on the vertex file, which outputs an edgelist file.

python get_verts.py names_to_search.csv verts_fname.csv
python get_edges.py verts_fname.csv edges_fname.csv

The twitter-graph.ipynb ipython-notebook shows a few examples of how you can programmatically generate some cool graphs and do analysis with the igraph package.

About

Making graphs of player-player connections on twitter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published