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 | |
import matplotlib.pyplot as plt | |
import matplotlib | |
matplotlib.style.use('ggplot') | |
%matplotlib inline | |
# team xref information | |
team_xref = pd.read_csv('data/team_xref.csv', sep=';') | |
print team_xref.shape |
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
sample Python code of running a shuffling and sampling of two populations |
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
R Shiny code |
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
R Shiny code |
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
# http://stackoverflow.com/questions/929103/convert-a-number-range-to-another-range-maintaining-ratio | |
def new_value(orig_inputs, new_min, new_max, old_value): | |
old_min = min(orig_inputs) | |
old_max = max(orig_inputs) | |
old_range = old_max - old_min | |
new_range = new_max - new_min | |
new_value = ((old_value - old_min) * new_range / old_range) + new_min | |
return new_value |
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
def craft_import_match(year, overall, overall_growth, craft, craft_growth, imp, imp_growth): | |
print "starting metrics:" | |
print "year:", year | |
print "overall %d BBLS and %3.3f percent growth" % (overall, overall_growth) | |
print "craft %d BBLS & %2.3f percent growth" % (craft, craft_growth) | |
print "import %d BBLS & %2.3f percent growth" % (imp, imp_growth) | |
print "\nyear\toverall_bbl\tcraft_bbl\timport_bbl" | |
while craft < imp: | |
year += 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
import csv | |
dutch_dict = {} | |
# stop words | |
with open('stopwords/stopwords_table_wTrans.csv', 'r') as f: | |
reader = csv.reader(f) | |
reader.next() | |
for row in reader: | |
dutch_dict[row[1]] = row[5] |
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 | |
def lat_path(x): | |
grid = (x+1) * (x+1) | |
test_m = np.zeros(grid).reshape(x+1, x+1) | |
for row in range(x+1): | |
for col in range(x+1): |