You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am still fairly new to Python and Git, if this isn't the right location to post this question please instruct me.
I wish to extract all scoring play and apply a standard FF scoring schema to compare actual versus projection. Surprisingly enough I was expecting something in the cookbook but maybe I didn't find it.
So how can I load all scoring play for Week 1 2017 in a Pandas DF ?
EDIT: Here the code I have so far, just looking for advice.
import nflgame
players = nflgame.combine_game_stats(nflgame.games(2017, 1))
scoring = {
# Passing
'passing_yds' : lambda x : x*.04,
'passing_tds' : lambda x : x*4,
'passing_twoptm' : lambda x : x*2,
# Rushing
'rushing_yds' : lambda x : x*.1 + (2 if x >= 100 else 0),
'rushing_tds' : lambda x : x*6,
'kickret_tds' : lambda x : x*6,
'rushing_twoptm' : lambda x : x*2,
# Receiving
'receiving_tds' : lambda x : x*6,
'receiving_yds' : lambda x : x*.1 + (2 if x >= 100 else 0),
'receiving_rec' : lambda x : x*.5,
'receiving_twoptm' : lambda x : x*2,
# Various
'fumbles_lost' : lambda x : x*-2,
'passing_ints' : lambda x : x*-2,
}
def score_player(player):
score = 0
for stat in player._stats:
if stat in scoring:
score += scoring[stat](getattr(player,stat))
return score
for p in players.limit(10):
score = score_player(p)
print (p,score)
The text was updated successfully, but these errors were encountered:
I am still fairly new to Python and Git, if this isn't the right location to post this question please instruct me.
I wish to extract all scoring play and apply a standard FF scoring schema to compare actual versus projection. Surprisingly enough I was expecting something in the cookbook but maybe I didn't find it.
So how can I load all scoring play for Week 1 2017 in a Pandas DF ?
EDIT: Here the code I have so far, just looking for advice.
The text was updated successfully, but these errors were encountered: