Git Product home page Git Product logo

ps239t-final-project's Introduction

ps239T-final-project

Date: 4/25/2018

Description:These scripts are part of a larger project focusing on examining political elites in Colombia on Twitter. The code found in this file can be used to gather locations of a Twitter user's 'friends' (i.e. who they themselves follow) and map all of the 'friends' that have put some sort of location into their profile info.

IDEs used:
Python: Jupyter Notebook, Python 3.6.1
R: RStudio, R Version 3.4.3 Kite-Eating-Tree
Packages used are:
Python: tweepy, json, csv, pandas, datetime, time
R: dplyr, ggmap, ggplot2, maps, stringr

Running the scripts

Order of running files is numerical.
1_twitter_api.ipynb
2_data_cleaning.R
3_visualization.R
4_saving_results.R

1_twitter_api

Go to developer.twitter.com to register an app and receive the 4 needed keys to access the API.
Create an empty (truly empty!) csv file in sublime or nano to work with for this script.
Run script! Refer to inline comments for explanations and logic.
Expected processing time is around 3 hours

2_data_cleaning

Read in the dataset produced from the previous script.
Clean and manipulate the data (see inline comments for explanations.)
Begin 3rd script when the main dictionary and all locations lists have been created. Dictionary uses Google Maps geocoding API and requires another app and keys.
Note: When calling the geocode api, the rate limit is 2500 requests per day. Make sure you're calling these data right the first time Expected processing time is around 30 minutes

3_visualization

Using ggplot2, ggmap, and maps, create map charts (currently: 10)
Expected processing time is around 10 minutes

4_saving_results

In the loop, ggsave each chart as pdf. (Best to import in laTEX)
Expected processing time is around 10 minutes

ps239t-final-project's People

Contributors

ehearley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.