Last active
November 29, 2016 14:41
-
-
Save emgullufsen/3094f489cfaf032bf77c420794a51647 to your computer and use it in GitHub Desktop.
A python script / module for fetching some basketball data from Alaska School Activities Association at asaa.org.
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
1928 | |
- | |
29 | |
Petersburg | |
25 | |
Fairbanks | |
20 | |
1947 | |
- | |
48 | |
Ketchikan | |
34 | |
Fairbanks | |
33 (ot) | |
1948 | |
- | |
49 | |
Anchorage | |
40 | |
Juneau | |
32 | |
1949 | |
- | |
50 | |
Juneau | |
45 | |
Seward | |
44 | |
1950 | |
- | |
51 | |
Anchorage | |
59 | |
Juneau | |
58 | |
1951 | |
- | |
52 | |
Wrangell | |
55 | |
Anchorage | |
42 | |
1952 | |
- | |
53 | |
Fairbanks | |
57 | |
Douglas | |
48 | |
1953 | |
- | |
54 | |
Sitka | |
50 | |
Anchorage | |
48 | |
1954 | |
- | |
55 | |
Juneau | |
41 | |
Anchorage | |
39 (2ot) | |
1955 | |
- | |
56 | |
Ketchikan | |
70 | |
Anchorage | |
53 | |
1956 | |
- | |
57 | |
Anchorage | |
49 | |
Juneau | |
45 | |
1957 | |
- | |
58 | |
Juneau | |
57 | |
Anchorage | |
54 | |
1958 | |
- | |
59 | |
Lathrop | |
62 | |
Mt Edgecumbe | |
52 | |
1959 | |
- | |
60 | |
Juneau | |
53 | |
East | |
42 | |
1960 | |
- | |
61 | |
Juneau | |
46 | |
Seward | |
45 | |
1961 | |
- | |
62 | |
Ketchikan | |
67 | |
West | |
57 | |
1962 | |
- | |
63 | |
Juneau | |
55 | |
Eielson | |
50 | |
1963 | |
- | |
64 | |
Lathrop | |
72 | |
Ketchikan | |
54 | |
1964 | |
- | |
65 | |
Ketchikan | |
58 | |
East | |
53 (ot) | |
1965 | |
- | |
66 | |
Ketchikan | |
64 | |
Lathrop | |
59 | |
1966 | |
- | |
67 | |
Ketchikan | |
71 | |
West | |
62 | |
1967 | |
- | |
68 | |
Ketchikan | |
67 | |
West | |
36 | |
1968 | |
- | |
69 | |
Juneau | |
78 | |
Lathrop | |
71 (ot) | |
1969 | |
- | |
70 | |
East | |
71 | |
Wrangell | |
59 | |
1970 | |
- | |
71 | |
Dimond | |
73 | |
Petersburg | |
57 | |
1971 | |
- | |
72 | |
Lathrop | |
80 | |
Juneau | |
79 | |
1972 | |
- | |
73 | |
Juneau | |
62 | |
East | |
55 | |
1973 | |
- | |
74 | |
Ketchikan | |
58 | |
Eielson | |
54 | |
1974 | |
- | |
75 | |
East | |
66 | |
Bartlett | |
63 | |
1975 | |
- | |
76 | |
Dimond | |
83 | |
Ketchikan | |
55 | |
1976 | |
- | |
77 | |
East | |
90 | |
Monroe | |
73 | |
1977 | |
- | |
78 | |
East | |
66 | |
Dimond | |
44 | |
1978 | |
- | |
79 | |
Monroe | |
64 | |
East | |
62 | |
1979 | |
- | |
80 | |
Monroe | |
95 | |
West Valley | |
79 | |
1980 | |
- | |
81 | |
East | |
67 | |
Kenai | |
52 | |
1981 | |
- | |
82 | |
Juneau | |
60 | |
West | |
50 | |
1982 | |
- | |
83 | |
East | |
47 | |
Bartlett | |
44 | |
1983 | |
- | |
84 | |
East | |
56 | |
West Valley | |
55 | |
1984 | |
- | |
85 | |
East | |
69 | |
Bartlett | |
46 | |
1985 | |
- | |
86 | |
Bartlett | |
86 | |
East | |
70 | |
1986 | |
- | |
87 | |
Dimond | |
52 | |
Chugiak | |
46 | |
1987 | |
- | |
88 | |
West | |
54 | |
Chugiak | |
37 | |
1988 | |
- | |
89 | |
East | |
70 | |
West | |
61 | |
1989 | |
- | |
90 | |
West Valley | |
55 | |
East | |
42 | |
1990 | |
- | |
91 | |
Service | |
84 | |
Palmer | |
54 | |
1991 | |
- | |
92 | |
East | |
89 | |
Bartlett | |
73 | |
1992 | |
- | |
93 | |
East | |
92 | |
Bartlett | |
90 (3OT) | |
1993 | |
- | |
94 | |
East | |
93 | |
Juneau | |
60 | |
1994 | |
- | |
95 | |
East | |
97 | |
Palmer | |
60 | |
1995 | |
- | |
96 | |
Bartlett | |
55 | |
East | |
54 | |
1996 | |
- | |
97 | |
Juneau | |
67 | |
Colony | |
59 | |
1997 | |
- | |
98 | |
Juneau | |
50 | |
East | |
48 | |
1998 | |
- | |
99 | |
East | |
59 | |
Lathrop | |
56 | |
1999 | |
- | |
00 | |
East | |
76 | |
Dimond | |
63 | |
2000 | |
- | |
01 | |
Kodiak | |
55 | |
East | |
52 | |
2001 | |
- | |
02 | |
Bartlett | |
77 | |
Juneau | |
64 | |
2002 | |
- | |
03 | |
Bartlett | |
38 | |
Wasilla | |
28 | |
2003 | |
- | |
04 | |
West | |
70 | |
Bartlett | |
69 (OT) | |
2004 | |
- | |
05 | |
West | |
72 | |
Colony | |
47 | |
2005 | |
- | |
06 | |
West | |
91 | |
Chugiak | |
58 | |
2006 | |
- | |
07 | |
Wasilla | |
50 | |
Colony | |
41 | |
2007 | |
- | |
08 | |
South | |
56 | |
Bartlett | |
54 | |
2008 | |
- | |
09 | |
Dimond | |
55 | |
Soldotna | |
52 (OT) | |
2009 | |
- | |
10 | |
West | |
80 | |
Wasilla | |
58 | |
2010 | |
- | |
11 | |
Bartlett | |
79 | |
West Anchorage | |
75 | |
2011 | |
- | |
12 | |
Dimond | |
57 | |
Service | |
51 (OT) | |
2012 | |
- | |
13 | |
East Anchorage | |
66 | |
Service | |
59 | |
2013 | |
- | |
14 | |
Service | |
49 | |
West Anchorage | |
47 |
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
#! /usr/local/python | |
import sqlite3 as s3 | |
class Scores: | |
def __init__(self, list): | |
self.year = int(list[0]) | |
self.winner = list[3] | |
self.wscore = int(list[4]) | |
self.loser = list[5] | |
try: | |
self.lscore = int(list[6]) | |
self.ots = 0 | |
except ValueError: | |
lscore_ot_list = str.split(list[6]) | |
ot_num_ornot = lscore_ot_list[1][1] | |
self.lscore = int(lscore_ot_list[0]) | |
self.ots = int(ot_num_ornot) if (str.isdigit(ot_num_ornot)) else 1 | |
def loadMyScores(self): | |
cli = s3.connect('AK_BALL.db') | |
c = cli.cursor() | |
toEx1 = '''CREATE TABLE IF NOT EXISTS CHAMPIONSHIPS_AK (YEAR INT, WINNER TEXT, WSCORE INT, LOSER TEXT, LSCORE INT, OTS INT)''' | |
toEx2 = "INSERT INTO CHAMPIONSHIPS_AK VALUES (?,?,?,?,?,?)" | |
c.execute(toEx1) | |
c.execute(toEx2, self.makeMySeq()) | |
cli.commit() | |
cli.close() | |
def makeMySeq(self): | |
return (self.year, self.winner, self.wscore, self.loser, self.lscore, self.ots) | |
def breakUpList (inty, listy): | |
acc = 1 | |
bigList = [] | |
while (acc <= (len(listy) / inty)): | |
county = inty * (acc - 1) | |
max = inty * acc | |
addList = [] | |
while (county < max): | |
try: | |
addList.append(listy[county]) | |
county += 1 | |
except IndexError: | |
break | |
bigList.append(addList) | |
acc += 1 | |
return bigList | |
def interpretScores(): | |
inFile = open("BBallData.txt", "r") | |
inFile.seek(0) | |
fiStri = inFile.read() | |
fiStriLi = fiStri.splitlines() | |
lineez = breakUpList(7, fiStriLi) | |
mS = map((lambda l: Scores(l)), lineez) | |
inFile.close() | |
return mS | |
def eO(listy, i, into): | |
acc = 1 | |
ssll = [] | |
while (acc * i <= len(listy)): | |
c = (acc - 1) * i | |
while (c < (acc * i)): | |
if ((c % i) == into): | |
ssll.append(listy[c]) | |
c += 1 | |
acc += 1 | |
return ssll | |
def addRecordsScores(listOfScores): | |
for x in listOfScores: | |
x.loadMyScores() | |
if __name__ == "__main__": | |
addRecordsScores(interpretScores()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def getHTMLandHustleIntoScores():