BurntSushi / nflgame

An API to retrieve and read NFL Game Center JSON data. It can work with real-time data, which can be used for fantasy football.
http://pdoc.burntsushi.net/nflgame
The Unlicense
1.27k stars 414 forks source link

Key error: 'kicking_fgm_yds' #165

Open SnappleCap opened 8 years ago

SnappleCap commented 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.

BurntSushi commented 8 years ago

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