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
First, I know this is transitioning over to https://github.com/derek-adair/nflgame, but I figure for now I might have a better shot of getting help here. Let me know if I should ask future questions over there.
I was trying to follow this cookbook script for calculating a team's sacks earned and modifying it for a team's fumbles recovered. I did something like this:
year = 2013
week = None
team = 'BAL'
games = nflgame.games_gen(year, week, team, team)
plays = nflgame.combine_plays(games)
for p in plays.filter(team__ne=team, defense_frec__gt=0):
print p
print p.defense_frec
which gives the following:
(BUF, BUF 45, Q2, 2 and 14) (15:00) E.Manuel sacked at BUF 36 for -9 yards (C.Canty). FUMBLES (C.Canty), RECOVERED by BAL-B.Williams at BUF 27. B.Williams to BUF 27 for no gain (L.Smith).
(PIT, PIT 31, Q2, 2 and 12) (:50) B.Roethlisberger pass short left to H.Miller to PIT 45 for 14 yards (D.Smith). FUMBLES (D.Smith), RECOVERED by BAL-M.Elam at PIT 45. M.Elam to PIT 38 for 7 yards (D.DeCastro).
(CLE, CLE 41, Q2, 2 and 8) (8:01) W.McGahee left guard to CLE 41 for no gain (P.McPhee). FUMBLES (P.McPhee), RECOVERED by BAL-J.Ihedigbo at CLE 38. J.Ihedigbo to CLE 38 for no gain (G.Little).
(CLE, CLE 49, Q3, 4 and 1) (6:01) (Punt formation) S.Lanning punts 38 yards to BAL 13, Center-C.Yount. T.Doss MUFFS catch, touched at BAL 13, RECOVERED by CLE-E.Martin at BAL 11. E.Martin to BAL 11 for no gain (C.Graham).
(NYJ, NYJ 26, Q2, 3 and 13) (9:18) (No Huddle, Shotgun) G.Smith FUMBLES (Aborted) at NYJ 26, RECOVERED by BAL-T.Suggs at NYJ 18. T.Suggs to NYJ 18 for no gain (D.Ferguson).
(MIN, MIN 20, Q1, 1 and 20) (6:36) T.Gerhart left guard to MIN 22 for 2 yards (J.Ihedigbo). FUMBLES (J.Ihedigbo), RECOVERED by BAL-M.Elam at MIN 25. M.Elam to MIN 25 for no gain (P.Loadholt). The Replay Assistant challenged the fumble ruling, and the play was Upheld.
These are mostly reasonable, except for the 4th one, where Cleveland punts, Baltimore muffs the catch, and Cleveland recovers. If we switch the team__ne=team to team=team, then we get the opposite problem, where the first play shows
(BAL, DEN 40, Q2, 4 and 5) (8:18) S.Koch punts 38 yards to DEN 2, Center-M.Cox. W.Welker MUFFS catch, touched at DEN 2, RECOVERED by BAL-M.Cox at DEN 2. M.Cox to DEN 2 for no gain (W.Welker).
which is a Baltimore fumble recovery that would be missed by the original snippet. Is there a way to account for kicking team recoveries properly?
The text was updated successfully, but these errors were encountered:
Something like this seems to work. If someone could let me know if there's a better way, I'd appreciate it:
year = 2013
week = None
team = 'BAL'
games = nflgame.games_gen(year, week, team, team)
plays = nflgame.combine_plays(games)
for p in plays.filter(team=team):
if (p.punting_tot != 0) or (p.kicking_tot != 0):
if p.defense_frec > 0:
print p
which gave me
(BAL, DEN 40, Q2, 4 and 5) (8:18) S.Koch punts 38 yards to DEN 2, Center-M.Cox. W.Welker MUFFS catch, touched at DEN 2, RECOVERED by BAL-M.Cox at DEN 2. M.Cox to DEN 2 for no gain (W.Welker).
(BAL, BAL 30, Q2, 4 and 13) (9:13) (Punt formation) S.Koch punts 6 yards to BAL 36, Center-M.Cox. J.Kuhn MUFFS catch, RECOVERED by BAL-J.Ihedigbo at BAL 41. J.Ihedigbo to BAL 41 for no gain (B.Bostick). GB 82 Deflected the punt
which seem to correctly identify "fumble recoveries" on punting/kicking plays
First, I know this is transitioning over to https://github.com/derek-adair/nflgame, but I figure for now I might have a better shot of getting help here. Let me know if I should ask future questions over there.
I was trying to follow this cookbook script for calculating a team's sacks earned and modifying it for a team's fumbles recovered. I did something like this:
which gives the following:
These are mostly reasonable, except for the 4th one, where Cleveland punts, Baltimore muffs the catch, and Cleveland recovers. If we switch the
team__ne=team
toteam=team
, then we get the opposite problem, where the first play showswhich is a Baltimore fumble recovery that would be missed by the original snippet. Is there a way to account for kicking team recoveries properly?
The text was updated successfully, but these errors were encountered: