-
Notifications
You must be signed in to change notification settings - Fork 0
/
playerData.py
55 lines (36 loc) · 1.83 KB
/
playerData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## playerData.py ###############################################################
################################################################################
from sys import argv
from scrapParam import *
from collections import Counter
def moduleId():
return "playerData"
def task(seasons, parameters):
## ids needed to open the proper folders and csv files contained within
##seasons = filterSeasonsByParams(seasons, parameters)
## NOT going to do this, because we want alllll of the data
## retrieve list of seasons from the manifest for this level
##franchises = getFranchiseList(leagueId, levelId)
franchises = False
##seasonIndexList = getSeasonIndexList(leagueId)
for season in seasons:
if(season.getSeasonId() == seasonId):
for team in season.Teams:
if(team.getTeamName() == teamName):
print team.getDescriptionString()
teamExpectedMawquee = 0.000
for player in team.getPlayers():
player.getStatsLine(getSeasonIndexById(seasonId, getSeasonIndexList(leagueId)))
print getSeasonIndexById(seasonId, getSeasonIndexList(leagueId))
teamExpectedMawquee += player.getPlayerMaAWQI(getSeasonIndexById(seasonId, getSeasonIndexList(leagueId)))
teamExpectedMawquee /= float(len(team.getPlayers()))
print "Team expected MaAWQI %.3f, Actual %.3f, diff %.3f" % (teamExpectedMawquee, team.getMaAWQI(), (team.getMaAWQI()-teamExpectedMawquee))
if(__name__ == "__main__"):
leagueId = argv[1]
## ie 'watMu'
if(leagueId == "watMu"):
seasons = getAllSeasons(leagueId, 'beginner') + getAllSeasons(leagueId, 'intermediate') + getAllSeasons(leagueId, 'advanced') + getAllSeasons(leagueId, 'allstar')
else:
seasons = getAllSeasons('nhl', 'everything') + getAllSeasons('wha', 'everything')
parameters = scrapParams(leagueId, levelId='everything')
task(seasons, parameters)