Open SnappleCap opened 8 years ago
I made a function to return the number of yards of field goals made by one specific player:
def kickerScore(playerName, year, week): if nflgame.find(playerName, team=None): playa = nflgame.find(playerName, team=None) [0] points = 0 m = playa.stats(year, week) z = playa.plays(year, week) print m if 'kicking_fgm' in m.stats: print "hi" points = 1*m.stats['kicking_fgm_yds'] print points else: print "Player not found."
But I get the key error I listed in the title of this post. kicking_fgm_yds is listed in statmap.py. Why might I be getting this error? Thanks.
I think stats returns game level stats, which doesn't have all the data. My response in this issue might help: https://github.com/BurntSushi/nflgame/issues/161
stats
I made a function to return the number of yards of field goals made by one specific player:
def kickerScore(playerName, year, week): if nflgame.find(playerName, team=None): playa = nflgame.find(playerName, team=None) [0] points = 0 m = playa.stats(year, week) z = playa.plays(year, week) print m if 'kicking_fgm' in m.stats: print "hi" points = 1*m.stats['kicking_fgm_yds'] print points else: print "Player not found."
But I get the key error I listed in the title of this post. kicking_fgm_yds is listed in statmap.py. Why might I be getting this error? Thanks.