-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help Finding Each Teams Rushing Yards Each Game #155
Comments
You are adding a "Y" or "N" to Since there are 32 teams in the league, your |
A version of what you were after that might give you some new ideas.
import nfldb
def team_rushing_total(db, year, s_type, week, team):
q = nfldb.Query(db)
q.game(season_year=year, season_type=s_type, week=week, team=team)
q.play_player(team=team)
pps = q.as_aggregate()
return sum(pp.rushing_yds for pp in pps)
counterYW = counterYL = counterNW = counterNL = 0
db = nfldb.connect()
q = nfldb.Query(db)
q.game(season_year=2015, season_type='Regular')
for game in q.as_games():
if team_rushing_total(db, game.season_year, game.season_type, game.week, game.winner) > 150:
counterYW += 1
else:
counterNW += 1
if team_rushing_total(db, game.season_year, game.season_type, game.week, game.loser) > 150:
counterYL += 1
else:
counterNL += 1
print 'YW: ' + str(counterYW)
print 'NW: ' + str(counterNW)
print 'YL: ' + str(counterYL)
print 'NL: ' + str(counterNL)
print '='*25
print 'Winners: {}'.format(counterYW+counterNW)
print 'Losers: {}'.format(counterYL+counterNL)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to determine the strength of the association between wins a high amount of rushing yards. I made an empty list called over150 to store 'Y' or 'N' values depending on if the team had over 150 yards that game. I have another array called winLoss to store 'W' or 'L' values depending on if the team won. I have a list called teamsList with all the abbreviations of the teams. Finally, rushArray will combine over150 and winLoss so I can compare. I created counters for each combination of W/L and Y/N.
Here is what I have:
counterYW counts the number of Wins with over 150 yards. counterYL counts the number of Losses with over 150 yards, etc.
The program does not run correctly, however, because over150 has 544 elements while winLoss has 512 (which it should). Is there any reason why over150 has 32 more elements than winLoss?
Please help,
Thanks
The text was updated successfully, but these errors were encountered: