Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
class Table(list): | |
""" | |
a table object that can be sliced like a numpy array | |
""" | |
def __init__(self, *args, has_header=True): | |
self.has_header = has_header | |
if has_header: | |
self.header_index = {} |
DO | |
$BODY$ | |
DECLARE | |
_sql text; | |
BEGIN | |
EXECUTE 'SET search_path = topology,public;'; | |
EXECUTE 'ALTER SCHEMA topology OWNER TO rds_superuser;'; |
import pandas as pd | |
import re | |
import urllib2 | |
import pprint | |
import json | |
def geocode(place): | |
add = urllib2.quote(place) | |
geocode_url = "http://maps.googleapis.com/maps/api/geocode/json?address=%s&sensor=false®ion=us" % add |
import scipy.stats as ss | |
from scipy.stats import norm, beta, zscore, gamma | |
import numpy as np | |
from math import sqrt | |
from itertools import chain, permutations | |
# the functions below aim to replicate the R function here: | |
# http://stat.ethz.ch/R-manual/R-patched/library/stats/html/power.prop.test.html |
<meta name="keywords" content="Maine, news, elections, election results, politics, sports, Bangor, Portland, Augusta, weather, obituaries, Waterville, Aroostook, Penobscot, Piscataquis, Somerset, Hancock, Washington, bdn, health, next, nation, regions, we all want to die with dignity, but not yet, is_article, unbylined" /> |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
{ | |
"settings": { | |
"number_of_shards": 5, | |
"analysis": { | |
"analyzer": { | |
"happy_tokens": { | |
"type": "pattern", | |
"tokenizer": "split_on_comma", | |
"char_filter": ["kill_pluses"] | |
} |
curl -X GET "http://elastic-04:9200/logstash-2015.04.07/_search/?pretty" -d' | |
{ | |
"size" : 0, | |
"query": { | |
"filtered": { | |
"query": { | |
"match": {"query_string.userId[muid]" : "46bce8bec4abf177"} | |
}, | |
"filter": { | |
"range": { |
## get all the pageviews on the boundary-vpc host in the last hour, sort by timestamp | |
curl -X GET "http://elastic-04:9200/logstash-2015.03.31/_search/?pretty" -d' | |
{ | |
"query": { | |
"filtered": { | |
"query": { | |
"match": {"host" : "boundary-vpc"} | |
}, | |
"filter": { |
curl -X GET "http://elastic-04:9200/content/_search/?size=10" -d' | |
{ | |
"query" : { | |
"common": { | |
"post_content": { | |
"query": "waterfront concert series", | |
"cutoff_frequency": 0.001, | |
"low_freq_operator" : "and" | |
} | |
} |