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
UPDATE graffiti_locations | |
SET the_geom = ST_Transform( | |
ST_SetSRID( | |
ST_MakePoint(x * 0.3048006096012192, y * 0.3048006096012192), | |
32118), | |
4326 | |
) |
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
print('hello world!') |
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 | |
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() |
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
<html> | |
<head> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<style> | |
label { | |
font: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
} | |
</style> |
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 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' |
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
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. |
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
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', |
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 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' |
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
from random import shuffle | |
import copy | |
""" | |
SudokuGenerator | |
input: grid can be a 2-D matrix of a Sudoku puzzle to solve, or None to generate a new puzzle. | |
""" | |
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
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() |
OlderNewer