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 copy | |
| from scrapy import Item | |
| class ModelItem(Item): | |
| """ | |
| Make Peewee models easily turn into Scrapy Items. | |
| >>> from models import Player | |
| >>> item = ModelItem(Player()) | |
| """ |
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
| """ | |
| A simple FiveThirtyEight palette for Seaborn plots. | |
| """ | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| five_thirty_eight = [ | |
| "#30a2da", | |
| "#fc4f30", |
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
| """ | |
| Multiclass SVMs (Crammer-Singer formulation). | |
| A pure Python re-implementation of: | |
| Large-scale Multiclass Support Vector Machine Training via Euclidean Projection onto the Simplex. | |
| Mathieu Blondel, Akinori Fujino, and Naonori Ueda. | |
| ICPR 2014. | |
| http://www.mblondel.org/publications/mblondel-icpr2014.pdf | |
| """ |
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
| #!/usr/bin/env python | |
| """ | |
| Turn CSV input into TSV output. | |
| """ | |
| import csv, sys | |
| for row in csv.reader(sys.stdin): | |
| print("\t".join(row)) |
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
| """ | |
| Geometric mean calculation in Python. | |
| """ | |
| import math | |
| import operator | |
| from random import randint | |
| from timeit import timeit | |
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
| " Vim color file | |
| " Converted from Textmate theme Monokai using Coloration v0.3.2 (http://github.com/sickill/coloration) | |
| set background=dark | |
| highlight clear | |
| if exists("syntax_on") | |
| syntax reset | |
| endif |
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 requests as req | |
| response = req.get("http://api.stlouisfed.org/fred/releases?api_key=CHYEA") | |
| print response.content |
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 fred | |
| fred.key('my_fred_key') | |
| data = fred.observations('AAA', limit=10, frequency='q', units='ch1') | |
| for obs in data['observations']['observation']: | |
| print obs['value'] |
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
| """ | |
| Example taken from: | |
| http://scikit-learn.org/dev/auto_examples/plot_digits_pipe.html | |
| """ | |
| import numpy as np | |
| import pylab as pl | |
| from sklearn.datasets import load_digits |
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 three | |
| three.city('macon') | |
| # This works | |
| three.post('123', address='123 Any St', name='Zach Williams', | |
| phone='555-5555', description='My issue description.') | |
| # And, this works. | |
| three.post(status_code='123', address='123 Any St', name='Zach Williams', |