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 urllib, urlparse | |
import re | |
import random | |
import numpy | |
API_KEY = "SDQL_KEY" | |
# I want to jiggle Y and Yo? | |
def jiggler(lst,jiggle): | |
return [x + jiggle * ( random.random() - 0.6 ) for x in lst] |
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 urllib, urlparse | |
import re | |
import random | |
import numpy | |
API_KEY = "SDQL_KEY" | |
# I want to jiggle Y and Yo? | |
def jiggler(lst,jiggle): | |
return [x + jiggle * ( random.random() - 0.6 ) for x in lst] |
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
#combine elements with same name in two named lists (useful for combining layouts) | |
appendList <- function (x, val) | |
{ | |
stopifnot(is.list(x), is.list(val)) | |
xnames <- names(x) | |
for (v in names(val)) { | |
x[[v]] <- if (v %in% xnames && is.list(x[[v]]) && is.list(val[[v]])) | |
appendList(x[[v]], val[[v]]) | |
else c(x[[v]], val[[v]]) | |
} |
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
#combine elements with same name in two named lists (useful for combining layouts) | |
appendList <- function (x, val) | |
{ | |
stopifnot(is.list(x), is.list(val)) | |
xnames <- names(x) | |
for (v in names(val)) { | |
x[[v]] <- if (v %in% xnames && is.list(x[[v]]) && is.list(val[[v]])) | |
appendList(x[[v]], val[[v]]) | |
else c(x[[v]], val[[v]]) | |
} |
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
#################################### | |
# diamond data bar chart | |
# Questions? Email [email protected] | |
# For more docs, see plot.ly/api | |
#################################### | |
library(plotly) | |
py <- plotly(username='USERNAME', key='API_KEY') | |
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
#################################### | |
# diamond data bar chart | |
# Questions? Email [email protected] | |
# For more docs, see plot.ly/api | |
#################################### | |
library(plotly) | |
py <- plotly(username='USERNAME', key='API_KEY') | |
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
Sherrod Brown | |
term N end 1996-10-04 | |
term N+1 start 1997-01-07 | |
gap % 365: 95 | |
Benjamin L. Cardin | |
term N end 1988-10-22 | |
term N+1 start 1989-01-03 | |
gap % 365: 73 |
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 json | |
from datetime import datetime | |
import time | |
def parse_date(date): | |
return datetime.strptime(date, "%Y-%m-%d").date() | |
count = 0 | |
leg_count = 0 | |
old_ends = [] |
NewerOlder