Skip to content

Instantly share code, notes, and snippets.

UPDATE graffiti_locations
SET the_geom = ST_Transform(
ST_SetSRID(
ST_MakePoint(x * 0.3048006096012192, y * 0.3048006096012192),
32118),
4326
)
print('hello world!')
import csv
from requests_html import HTMLSession
class FashionArticleScraper:
def __init__(self, csv_file_path):
self.csv_file_path = csv_file_path
self.base_url = 'https://www.nytimes.com/section/fashion'
self.headers = {'User-Agent': 'LVNGDBot 1.0'}
self.process_fashion_articles()
<!DOCTYPE html>
<meta charset="utf-8">
<style>
div#map-container {
width: 800px;
height: 600px;
}
</style>
<body>
<div id="map-container">
class CocktailSuggester:
def __init__(self, ingredients, ratio=0):
self.ratio = ratio
self.ingredients = self.format_ingredients(ingredients)
#lookup tables and graph
self.cocktails_to_ingredients, self.ingredients_to_cocktails, self.compatible_ingredients = self.get_cocktail_lookups()
self.cocktail_matches = set()
self.partial_cocktails = {}
self.make_cocktail()
import requests
import pandas as pd
"""
Script to fetch 50,000 311 noise complaints from NYC Open Data.
Substitute your own API key.
"""
NYC_OPEN_DATA_API_KEY='xxxxxxxxxx'
dob_violation_codes = {'B':'Boiler',
'V': 'DOB Violation',
'VP': 'Violation Unserved ECB-Active',
'VP*': 'Violation Unserved ECB-Dismissed',
'BDM': 'Boiler',
'V*': 'DOB Violation Dismissed',
'BMD': 'Boiler',
'V%': 'Precept issued for Unsafe Buildings Violation',
'C': 'Construction' ,
'VAC': 'Vacate',
from __future__ import unicode_literals, print_function
import random
import plac
import pickle
from pathlib import Path
import spacy
from spacy.util import minibatch, compounding
"""
Script to train a custom Named Entity Recognizer with Spacy.
import nltk
from nltk.tag.stanford import StanfordNERTagger
"""
Named Entity tagging in Python with NLTK and the Stanford NER tagger
"""
PATH_TO_JAR='/Users/christina/Projects/stanford_nlp/stanford-ner/stanford-ner.jar'
PATH_TO_MODEL = '/Users/christina/Projects/stanford_nlp/stanford-ner/classifiers/english.all.3class.distsim.crf.ser.gz'
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="//d3js.org/d3-scale-chromatic.v0.3.min.js"></script>
</head>
<body>
<div id="map-container"></div>
<script>