Skip to content

Instantly share code, notes, and snippets.

@ochawkeye
Last active October 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ochawkeye/218af58fe96dcf4083df to your computer and use it in GitHub Desktop.
Save ochawkeye/218af58fe96dcf4083df to your computer and use it in GitHub Desktop.
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
plays = filter(redzone('OPP 20'), q.as_plays())
for play in plays:
print play
@ochawkeye
Copy link
Author

(DET, OPP 14, Q1, 2 and 2) (12:15) (Shotgun) C.Lucas reported in as eligible.  A.Abdullah left tackle to MIN 6 for 8 yards (E.Kendricks).
(DET, OPP 6, Q1, 1 and 6) (11:30) (Shotgun) M.Stafford pass short left to T.Riddick to MIN 1 for 5 yards (H.Smith) [B.Robison].
(DET, OPP 1, Q1, 2 and 1) (11:15) (No Huddle) M.Stafford pass short left to C.Johnson for 1 yard, TOUCHDOWN.
(DET, OPP 15, Q1) M.Prater extra point is GOOD, Center-D.Muhlbach, Holder-S.Martin.
(MIN, OPP 18, Q1, 1 and 10) (4:35) T.Bridgewater sacked ob at DET 19 for -1 yards (K.Van Noy).
(MIN, OPP 19, Q1, 2 and 11) (4:06) T.Bridgewater pass incomplete deep left to S.Diggs.
(MIN, OPP 19, Q1, 3 and 11) (3:59) (Shotgun) T.Bridgewater pass incomplete short left to J.Wright.
(MIN, OPP 19, Q1, 4 and 11) (3:51) B.Walsh 37 yard field goal is GOOD, Center-K.McDermott, Holder-J.Locke.
(DET, OPP 16, Q1, 2 and 1) (2:16) A.Abdullah up the middle to MIN 7 for 9 yards (H.Smith; T.Newman).
(DET, OPP 7, Q1, 1 and 7) (1:30) (Shotgun) M.Stafford pass short middle to E.Ebron for 7 yards, TOUCHDOWN.
(DET, OPP 15, Q1) M.Prater extra point is GOOD, Center-D.Muhlbach, Holder-S.Martin.
(MIN, OPP 19, Q2, 1 and 10) (3:39) J.McKinnon left end to DET 10 for 9 yards (H.Ngata).
(MIN, OPP 10, Q2, 2 and 1) (2:56) J.McKinnon up the middle to DET 4 for 6 yards (J.Bynes, J.Ihedigbo).
(MIN, OPP 4, Q2, 1 and 4) (2:14) J.McKinnon up the middle to DET 2 for 2 yards (J.Jones).
(MIN, OPP 2, Q2, 2 and 2) (2:00) (Shotgun) A.Peterson right tackle to DET 1 for 1 yard (J.Bynes; C.Reid).
(MIN, OPP 1, Q2, 3 and 1) (1:54) A.Shepherd reported in as eligible.  T.Bridgewater pass short right to K.Rudolph for 1 yard, TOUCHDOWN [T.Whitehead].
(MIN, OPP 15, Q2) B.Walsh extra point is No Good, Wide Right, Center-K.McDermott, Holder-J.Locke.
(MIN, OPP 15, Q3) B.Walsh extra point is GOOD, Center-K.McDermott, Holder-J.Locke.
(MIN, OPP 3, Q3, 1 and 3) (7:41) A.Peterson left tackle to DET 6 for -3 yards (S.Tulloch).
(MIN, OPP 6, Q3, 2 and 6) (6:59) (Shotgun) T.Bridgewater pass incomplete short right to M.Wallace (D.Slay).
(MIN, OPP 6, Q3, 3 and 6) (6:54) (Shotgun) T.Bridgewater sacked at DET 17 for -11 yards (C.Reid).
(MIN, OPP 17, Q3, 4 and 17) (6:11) B.Walsh 35 yard field goal is GOOD, Center-K.McDermott, Holder-J.Locke.
(MIN, OPP 2, Q3, 1 and 2) (:48) A.Shepherd reported in as eligible.  A.Peterson left tackle to DET 4 for -2 yards (C.Reid).
(MIN, OPP 4, Q4, 2 and 4) (15:00) T.Bridgewater pass incomplete short right. Ball thrown away.
(MIN, OPP 4, Q4, 3 and 4) (14:54) (Shotgun) T.Bridgewater pass short left to M.Asiata to DET 4 for no gain (T.Whitehead).
(MIN, OPP 4, Q4, 4 and 4) (14:13) B.Walsh 22 yard field goal is GOOD, Center-K.McDermott, Holder-J.Locke.
(DET, OPP 10, Q4, 1 and 10) (2:53) (Shotgun) M.Stafford pass short right to C.Johnson to MIN 1 for 9 yards (A.Barr) [H.Smith].
(DET, OPP 1, Q4, 2 and 1) (2:29) M.Stafford pass incomplete short right to C.Johnson (X.Rhodes). PENALTY on MIN-C.Munnerlyn, Defensive Offside, 0 yards, enforced at MIN 1 - No Play.
(DET, OPP 1, Q4, 2 and 1) (2:28) G.Winn right tackle to MIN 1 for no gain (B.Robison).
(DET, OPP 1, Q4, 3 and 1) (2:06) M.Burton right tackle to MIN 1 for no gain (L.Joseph; T.Johnson).
(DET, OPP 1, Q4, 4 and 1) (2:00) (Shotgun) M.Stafford pass incomplete short left to T.Riddick.

@chppppp
Copy link

chppppp commented Oct 29, 2015

Why did you take it from as_plays rather as_drives?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment