This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@author Michael J Bommarito II | |
@date Feb 26, 2011 | |
@license Simplified BSD, (C) 2011. | |
This script demonstrates how to use Python to archive historical tweets. | |
''' | |
import codecs | |
import csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @author: Michael J Bommarito II | |
# @date: Feb 21, 2011 | |
# @email: [email protected] | |
# @packages: ggplot2 | |
library(ggplot2) | |
setwd('/data/workspace/blog/wiunion/') | |
# Load and pre-process #tweets_wiunion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@author Michael J Bommarito II | |
@contact [email protected] | |
@date Feb 21, 2011 | |
@license Simplified BSD, (C) 2011. | |
Plot the network of the first 1000 #cn220 tweets with igraph and cairo. | |
''' | |
import cairo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@author Michael J Bommarito | |
#@contact [email protected] | |
#@date Feb 20, 2011 | |
#@ip Simplified BSD, (C) 2011. | |
# This is a simple example of an R script that will retrieve | |
# public tweets from a given hashtag. | |
library(RJSONIO) | |
# This function loads stored tag data to determine the current max_id. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @author: Michael J Bommarito II | |
# @date: Feb 20, 2011 | |
# @email: [email protected] | |
# @packages: gridExtra, ggplot2 | |
library(gridExtra) | |
library(ggplot2) | |
setwd('/data/workspace/blog/cn220/') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@author Michael J Bommarito II | |
#@date Feb 16, 2011 | |
library(tm) | |
# Load the tweets | |
tweets <- unique(read.table('data/tweets_25bahman.csv', sep="\t", quote="", comment.char="", header=FALSE, nrows=100000, stringsAsFactors=FALSE)) | |
names(tweets) <- c("id", "date", "user", "text") | |
# Build the corpus and then apply the tm pre-processing methods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@author Michael J Bommarito II | |
@date Feb 16, 2011 | |
''' | |
import codecs | |
import dateutil.parser | |
import multiprocessing | |
import nltk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import datetime | |
import dateutil.parser | |
import lxml, lxml.etree | |
import urllib2 | |
# Setup date-related variables | |
today = datetime.date.today() | |
todayString = today.strftime('%m/%d/%Y') | |
rangeString = '20050825_{0}'.format(today.strftime('%Y%m%d')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Initialize | |
clear all; | |
startDate = datenum('2005-08-25'); | |
endDate = datenum('2010-10-20'); | |
dateRange = busdays(startDate, endDate); | |
%% Load SPY data | |
csvFile = fopen('data/SPY.csv', 'r'); | |
csvFields = textscan(csvFile, '%s %f %f %f %f %f %f',-1,'delimiter',',','HeaderLines',1); | |
fclose(csvFile); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import dateutil.parser | |
import lxml, lxml.etree | |
rangeString = '20050825_20101025' | |
xmlRoot = lxml.etree.parse("data/pomo_{0}.xml".format(rangeString)).getroot() | |
xmlData = xmlRoot.getchildren()[1] | |
pomoData = [] |