View nadro.py
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
import nfldb | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
q.game(season_year=2016, week=6) | |
for game in q.as_games(): | |
print game | |
print game.winner, game.loser |
View Frank_.py
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
import nflgame | |
games = nflgame.games(year=2016, kind='REG') | |
for game in games: | |
print game | |
""" | |
CAR (20) at DEN (21) | |
TB (31) at ATL (24) | |
BUF (7) at BAL (13) |
View mesee298.py
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
"""Display a chart of games that have and have not yet been played for a given week.""" | |
import nflgame | |
def started_ticker(game): | |
print '{}\t{}\t\t{}'.format(game.away, game.score_away, game.time) | |
print '{}\t{}'.format(game.home, game.score_home) | |
print '-'*25 | |
def unstarted_ticker(game): |
View NE_drives.py
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
import nfldb | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
q.game(season_year=2015, season_type='Regular', team='NE',) | |
print len(q.as_drives()) | |
q.drive(pos_team='NE') | |
print len(q.as_drives()) |
View another_redzone_example.py
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
import nfldb | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
team = 'MIN' | |
def redzone(field): | |
cutoff = nfldb.FieldPosition.from_str(field) | |
return lambda play: play.yardline >= cutoff |
View brady_redzone.py
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
import nfldb | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
q.game(season_year=2015) | |
q.player(full_name='Tom Brady') | |
q.play(offense_tds=1) | |
def redzone(field): | |
cutoff = nfldb.FieldPosition.from_str(field) |
View redzone_example.py
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
import nfldb | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
q.game(season_year=2015, week=7, team='MIN') | |
def redzone(field): | |
cutoff = nfldb.FieldPosition.from_str(field) | |
return lambda play: play.yardline >= cutoff |
View current.py
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
import nfldb | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
p, y, w = nfldb.current(db) | |
q.game(season_type=p, season_year=y, week=w) | |
print p, y, w | |
for pp in q.sort('passing_yds').limit(10).as_aggregate(): | |
print pp.player, pp.passing_yds |
View drive_results.py
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
import nfldb | |
from collections import defaultdict | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
q.game(season_year=2015, week=7) | |
results = {team[0]: {} for team in nfldb.team.teams} |
View turnovers.py
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
import nfldb | |
db = nfldb.connect() | |
q = nfldb.Query(db) | |
q.game(season_year=2015) | |
interceptions = {team[0]: 0 for team in nfldb.team.teams} | |
fumble_recoveries = {team[0]: 0 for team in nfldb.team.teams} | |
turnovers = {team[0]: 0 for team in nfldb.team.teams} |
NewerOlder