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 os | |
from boto.s3.connection import S3Connection | |
conn = S3Connection('<aws access key>', '<aws secret key>') | |
mybucket = conn.get_bucket('oeda') | |
# Need to modify this line to make sure the directory is correct | |
directory = 'phox/' |
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
cowcode1 | cowcode2 | year | pol_rel | terrorCounts | terrorCounts2 | rivalry | jointDem1 | logcapratio | historyl1 | historyl2 | coldwar1 | conflict1 | conflict2 | contiguity | war1 | war2 | dyadid | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | 20 | 1968 | 1 | 0 | 0 | 0 | 1 | 1.226615 | 3.583797 | .6981347 | 0 | 1 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1969 | 1 | 0 | 0 | 0 | 1 | 1.238537 | 3.020913 | .6981347 | 0 | 1 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1970 | 1 | 0 | 0 | 0 | 1 | 1.175389 | 3.044998 | 1.206968 | 0 | 1 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1971 | 1 | 0 | 0 | 0 | 1 | 1.142114 | 3.286908 | 1.015231 | 0 | 1 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1972 | 1 | 0 | 0 | 0 | 1 | 1.116908 | 3.17847 | .9593502 | 0 | 1 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1973 | 1 | 0 | 0 | 0 | 1 | 1.101906 | 3.143146 | .7777947 | 0 | 1 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1974 | 1 | 0 | 0 | 0 | 1 | 1.080219 | 3.207786 | .7667958 | 0 | 0 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1975 | 1 | 0 | 0 | 0 | 1 | 1.058303 | 3.413949 | .6981347 | 0 | 0 | 0 | 1 | 0 | 0 | 2020 | |
2 | 20 | 1976 | 1 | 0 | 0 | 0 | 1 | 1.060871 | 3.493439 | .6412689 | 0 | 0 | 0 | 1 | 0 | 0 | 2020 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/bin/bash | |
for file in $1* | |
do | |
genhash=`md5 "$file" | tail -c 33` | |
if grep -q "$genhash" "$2"; then | |
echo Found hash for "$file" | |
else | |
echo Did not find hash for "$file" | |
fi | |
done |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from path import path | |
import pandas as pd | |
unique_actors = dict() | |
lengths = list() | |
for in_file in path.getcwd().files('*.reduced.txt'): | |
data = open(in_file, 'r') | |
print "%s data read in...subsetting" % (in_file) | |
for line in data: | |
line = line.replace('\n', '') |
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
from path import path | |
import pandas as pd | |
allActors = ['AFG', 'ALA', 'ALB', 'DZA', 'ASM', 'AND', 'AGO', 'AIA', 'ATG', | |
'ARG', 'ARM', 'ABW', 'AUS', 'AUT', 'AZE', 'BHS', 'BHR', 'BGD', | |
'BRB', 'BLR', 'BEL', 'BLZ', 'BEN', 'BMU', 'BTN', 'BOL', 'BIH', | |
'BWA', 'BRA', 'VGB', 'BRN', 'BGR', 'BFA', 'BDI', 'KHM', 'CMR', | |
'CAN', 'CPV', 'CYM', 'CAF', 'TCD', 'CHL', 'CHN', 'COL', 'COM', | |
'COD', 'COG', 'COK', 'CRI', 'CIV', 'HRV', 'CUB', 'CYP', 'CZE', | |
'DNK', 'DJI', 'DMA', 'DOM', 'TMP', 'ECU', 'EGY', 'SLV', 'GNQ', |
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
{ | |
"metadata": { | |
"name": "Scraping Tutorial" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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 numpy as np | |
from joblib import Parallel, delayed | |
def subset(file): | |
dataOut = [] | |
data = open(file, 'r') | |
data.readline() | |
for line in data: | |
splitLine = line.split('\t') | |
if splitLine[3] == '57': |
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
from __future__ import division | |
import numpy as np | |
import pandas as pd | |
import random | |
def sample(data): | |
sample = [random.choice(data) for _ in xrange(len(data))] | |
return sample | |
def bootstrap_t_test(treatment, control, nboot = 1000, direction = "less"): |