Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.
This file contains 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
#!/usr/bin/env python | |
import sys | |
import csv | |
def MeanAveragePrecision(valid_filename, attempt_filename, at=10): | |
at = int(at) | |
valid = dict() | |
for line in csv.DictReader(open(valid_filename,'r')): | |
valid.setdefault(line['source_node'],set()).update(line['destination_nodes'].split(" ")) |
This file contains 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 | |
r = csv.reader(open('train.csv','r')) | |
r.next() | |
edges = set() | |
#commutative_graph = dict() | |
for edge in r: | |
edges.add((edge[0], edge[1])) | |
# commutative_graph.setdefault(edge[0], set()).add(edge[1]) |
This file contains 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
gameGrid = function(gridSize) { | |
var i; | |
window.a = []; | |
this.size = gridSize; | |
this.map = []; | |
for (i = 0; i < this.size; i++) { | |
this.map[i] = []; | |
} | |
}; |
This file contains 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 pandas as pd | |
import statsmodels.api as sm | |
import pylab as pl | |
import numpy as np | |
import sklearn.metrics | |
print "Reading DATA.CSV ... \n" | |
df = pd.read_csv('data.csv') | |
df.columns = ["numb", "age","frailty","sex","val"] | |
for i in range(df.shape[0]): |
This file contains 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 numpy as np | |
from datetime import date | |
claimsdata = np.genfromtxt('claims.csv', dtype = (int, object, object, int, object), delimiter=',', names = True) | |
poldata = np.genfromtxt('policies.csv', dtype = (int, object, object, object, object), delimiter=',', names = True) | |
f = open('categories') | |
f.readline() | |
dict1 = {} | |
for i in f.readlines(): | |
colorVal = i.split(',') | |
colorVal[1]=colorVal[1][:-1] |
We can't make this file beautiful and searchable because it's too large.
This file contains 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
300,100006 | |
300,100011 | |
300,100012 | |
300,100033 | |
300,100044 | |
300,100053 | |
300,100059 | |
300,100072 | |
300,100104 | |
300,100111 |
This file contains 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
from selenium import webdriver | |
import getpass | |
driver = webdriver.Firefox() | |
driver.get('https://myaccount.lib.ncsu.edu/') | |
user = driver.find_element_by_name('user_idp') | |
for option in user.find_elements_by_tag_name('option'): | |
if option.text == 'NC State Unity Users': |
This file contains 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
awk 'BEGIN { srand(systime()); } {if (rand() < 0.25) { print $0; } }' Train.csv > sampled_train.csv |
This file contains 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
(u'A. Flaxman', u'Matthias Ekman', u'Miroslav Batchkarov', u'Michael Eickenberg') | |
(u'Abhijeet Kolhe', u'Alexander Fabisch', u'James Mcdermott', u'F\xe9lix-Antoine Fortin') | |
(u'Adrien Gaidon', u'Justin Pati', u'Rafael Cunha De Almeida', u'Raul Garreta') | |
(u'Alemagnani', u'Roman', u'Matti Lyra', u'Lqdc') | |
(u'Alex Companioni', u'Jakemick', u'Bogdan Trach', u'Miroslav Batchkarov') | |
(u'Alexander Fabisch', u'Alexander Fabisch', u'Miroslav Batchkarov', u'Bogdan Trach') | |
(u'Alexandre Abraham', u'Jan Hendrik Metzen', u'F\xe9lix-Antoine Fortin', u'James Mcdermott') | |
(u'Alexandre Gramfort', u'Gaelvaroquaux', u'Immanuel Bayer', u'Andy') | |
(u'Alexandre Passos', u'Nzer0', u'Miroslav Batchkarov', u'Bogdan Trach') | |
(u'Alexis Mignon', u'Jamestwebber', u'Jansoe', u'Eugene Nizhibitsky') |
OlderNewer