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
| # List unique values in a DataFrame column | |
| # h/t @makmanalp for the updated syntax! | |
| df['Column Name'].unique() | |
| # Convert Series datatype to numeric (will error if column has non-numeric values) | |
| # h/t @makmanalp | |
| pd.to_numeric(df['Column Name']) | |
| # Convert Series datatype to numeric, changing non-numeric values to NaN | |
| # h/t @makmanalp for the updated syntax! |
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 numpy as np | |
| from keras.models import Sequential | |
| from keras.layers.core import Activation, Dense | |
| from keras.optimizers import SGD | |
| X = np.array([[0,0],[0,1],[1,0],[1,1]], "float32") | |
| y = np.array([[0],[1],[1],[0]], "float32") | |
| model = Sequential() | |
| model.add(Dense(2, input_dim=2, activation='sigmoid')) |
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
| # Note – this is not a bash script (some of the steps require reboot) | |
| # I named it .sh just so Github does correct syntax highlighting. | |
| # | |
| # This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5 | |
| # | |
| # The CUDA part is mostly based on this excellent blog post: | |
| # http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/ | |
| # Install various packages | |
| sudo apt-get update |
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
| # requires twill==0.9 | |
| import sys | |
| from twill import get_browser | |
| from pprint import pprint | |
| class PdfFinder: | |
| browser = None | |
| _b = None | |
| _q = None | |
| links = {} |
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 urllib | |
| import re | |
| import time | |
| data = urllib.urlopen('http://bitly.measuredvoice.com/bitly_archive/?C=M;O=D').read() | |
| #print data | |
| #datafiles name pattern - usagov_bitly_data2011-07-29-1311919454 |