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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<html> | |
<head> | |
<script src="http://d3js.org/d3.v4.js"></script> | |
<link href="https://fonts.googleapis.com/css?family=Assistant&display=swap" rel="stylesheet"> | |
</head> | |
<body> | |
<div id="chart"></div> |
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
<!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> |
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
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
body {font-family: helvetica;} | |
</style> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
</head> | |
<body> | |
<div id="chart"></div> |
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 random | |
""" | |
Computes the Convex Hull with the Graham Scan algorithm | |
Use: | |
h = ConvexHull() | |
print(h.hull) | |
""" |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
div#map-container { | |
width: 800px; | |
height: 600px; | |
} | |
</style> | |
<body> | |
<div id="map-container"> |
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 re | |
import string | |
import unidecode | |
from nltk.tokenize import sent_tokenize | |
from nltk.tokenize import word_tokenize | |
from nltk.stem import WordNetLemmatizer | |
from nltk.corpus import stopwords | |
import gensim.downloader as api | |
from pycontractions import Contractions | |
from word2number import w2n |
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() |
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
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
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', |