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 concurrent.futures import ProcessPoolExecutor | |
import concurrent.futures | |
from halas.parsers import boxscore | |
GAMES = [ ... ] | |
results = [] | |
with ProcessPoolExecutor(max_workers=4) as executor: | |
future_results = {executor.submit(boxscore, game): |
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
# for creating a column like "days since last login" | |
df = pd.read_clipboard(index_col=['customer_id', 'days']) | |
(df | |
.groupby(level='customer_id') | |
.did_login | |
.cumsum() | |
.to_frame() | |
.groupby(level='customer_id') | |
.apply(lambda g: g.groupby('did_login').cumcount()) |
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
# OSX 10.7.5 | |
# python 2.7.5 | |
# pandas 0.13.0 | |
# numpy 1.8.0 | |
import pandas as pd | |
import numpy as np | |
from StringIO import StringIO | |
d = """row1,'2013-10-01' |
NewerOlder