Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| i386 : iPhone Simulator | |
| x86_64 : iPhone Simulator | |
| arm64 : iPhone Simulator | |
| iPhone1,1 : iPhone | |
| iPhone1,2 : iPhone 3G | |
| iPhone2,1 : iPhone 3GS | |
| iPhone3,1 : iPhone 4 | |
| iPhone3,2 : iPhone 4 GSM Rev A | |
| iPhone3,3 : iPhone 4 CDMA | |
| iPhone4,1 : iPhone 4S |
| # -*- coding: utf-8 -*- | |
| class SimpleOption(object): | |
| NOTHING = False | |
| SOME = True | |
| def __init__(self, is_some, value=None): |
| #Mounting the share is a 2 stage process: | |
| # 1. Create a directory that will be the mount point | |
| # 2. Mount the share to that directory | |
| #Create the mount point: | |
| mkdir share_name | |
| #Mount the share: | |
| mount_smbfs //username:password@server.name/share_name share_name/ |
| import numpy as np | |
| def circumcenter(vert1, vert2, vert3): | |
| # H/T: wikipedia.org/wiki/Circumscribed_circle | |
| Ax, Ay = vert1 | |
| Bx, By = vert2 | |
| Cx, Cy = vert3 | |
| D = 2 * (Ax * (By - Cy) + Bx * (Cy - Ay) + Cx * (Ay - By)) |
| class KeyifyList(object): | |
| def __init__(self, inner, key): | |
| self.inner = inner | |
| self.key = key | |
| def __len__(self): | |
| return len(self.inner) | |
| def __getitem__(self, k): | |
| return self.key(self.inner[k]) |
| -- Feature engineering BigQuery SQL queries for the kaggle talkingdata competition by tkm2261 | |
| -- it may acheve 0.9823 on the public LB with simple GBDT. | |
| -- destination table: takling.test2 | |
| SELECT | |
| CASE WHEN t.click_id is null THEN -1 ELSE t.click_id END as click_id, | |
| o.* | |
| FROM | |
| `talking.test_supplement` as o | |
| LEFT OUTER JOIN |