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
# modules we're using | |
# (be sure that lxml is in your python installation) | |
import lxml.html, urllib2, urlparse, os, shutil | |
# construct a namespace dictionary to pass to the xpath() call | |
# this lets us use regular expressions in the xpath | |
ns = {'re': 'http://exslt.org/regular-expressions'} | |
# build dictionary of fiscal note search pages | |
d = { |
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
#cutlabels=FALSE gives nicer legend output | |
print(classIntervals(jenks71$jenks71, n=5, style="kmeans"), cutlabels=FALSE) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 round2(x): | |
"""Numpy rounds x.5 to nearest even integer. To emulate SAS/SPSS, | |
which both round x.5 *up* to nearest integer, use this function. | |
""" | |
y = x - np.floor(x) | |
if (0 < y < 0.5): | |
return np.floor(x) | |
else: | |
return np.ceil(x) |
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
/* 1. Download the 2011-2012 ARF data files from http://arf.hrsa.gov/ */ | |
/* 2. Download this gist into the same directory as the ARF file named arf2011.asc */ | |
/* 3. Issue these commands in your terminal application: */ | |
/* gcc -o asc2csv asc2csv.c */ | |
/* ./asc2csv arf2011.asc > arf2011.csv */ | |
/* 4. Open the resultant .csv data file with your R app of choice */ | |
#include <stdio.h> | |
#include <stdlib.h> |