Code Monkey home page Code Monkey logo

twitter-sma's Introduction

Twitter Streaming and Analysis with Python and R

Introduction

The Git repository contains Python and R code for a mini project to analyse tweets on consumer electronic brands. In the project, 15.3gb of tweets was downloaded from 13 - 25 may using Python and then analysed in R. A deck on the project process and outcomes is available here: http://www.slideshare.net/eugeneyan/diving-into-twitter-data

About the scripts

There are two main Python scripts that were used.

To download the data from Twitter's public streaming API, use the script listed below. Just (i) plug in your Twitter authentication details, (ii) change the directory and name where you want to save the data, and (iii) change the list of keywords to track and you're good to go!

  • tweets_to_json.py

To process and filter the downloaded json files, and convert to csv format, use the scripts below. Just (i) change the directory and name of the output file, (ii) the keywords you would like to filter on, (iii) and the fields you would like to keep.

  • tweetjson_to_csv.py ### does not have regular expression filtering
  • tweetjson_to_csv(with re).py ### has regular expression filtering
  • tweetjson_to_csv(with re)b.py ### has regular expression filtering and saves fewer fields in my bid to reduce the output file size

To reference my R script and output, check out the SMA folder. Feel free to use the R script as necessary though significant editing may be required (i.e., regular expression keywords, variable names, etc).

Enjoy!

twitter-sma's People

Contributors

eugeneyan avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.