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
from sklearn.base import BaseEstimator, TransformerMixin | |
class NoFitMixin: | |
"""Gives fit method by inheritance.""" | |
def fit(self, X, y=None, **fit_params): | |
return self | |
class LabelFeaturizer(BaseEstimator, TransformerMixin, NoFitMixin): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
import pandas as pd | |
def df_diff(df1, df2): | |
# Extracted from | |
# http://stackoverflow.com/a/17095620 | |
diffs = df1 != df2 | |
ne_stacked = diffs.stack() | |
changed = ne_stacked[ne_stacked] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
-- Found at http://stackoverflow.com/a/17922821/597349 | |
DROP TABLE IF EXISTS urlcodemap; | |
CREATE TABLE `urlcodemap` ( | |
`id` INT(11) NOT NULL AUTO_INCREMENT, | |
`encoded` VARCHAR(128) NOT NULL, | |
`decoded` VARCHAR(128) NOT NULL, | |
UNIQUE KEY urlcodemapUIdx1(encoded), | |
PRIMARY KEY (`id`) |
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
git clone https://github.com/yyuu/pyenv.git ~/.pyenv | |
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile | |
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile | |
pyenv install 3.4.3 | |
mkvirtualenv -p `pyenv which python3` env-py343 |
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
from IPython.display import display, HTML | |
display(HTML(data=""" | |
<style> | |
div#notebook-container { width: 95%; } | |
div#menubar-container { width: 65%; } | |
div#maintoolbar-container { width: 99%; } | |
</style> | |
""")) |
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
CREATE TABLE IF NOT EXISTS `country` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`iso` char(2) NOT NULL, | |
`name` varchar(80) NOT NULL, | |
`nicename` varchar(80) NOT NULL, | |
`iso3` char(3) DEFAULT NULL, | |
`numcode` smallint(6) DEFAULT NULL, | |
`phonecode` int(5) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
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
-- Retrieved from http://dev.mysql.com/doc/refman/5.6/en/string-functions.html at 2015-feb-10 18:16 | |
-- Working on MySQL version 5.6.19-0ubuntu0.14.04.1 (Ubuntu) | |
-- | |
-- Posted by Chris Stubben on August 21 2008 3:49pm | |
-- Split delimited strings | |
CREATE FUNCTION | |
strSplit(x VARCHAR(255), delim VARCHAR(12), pos INT) RETURNS VARCHAR(255) | |
return | |
REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos), |