nfldb icon indicating copy to clipboard operation
nfldb copied to clipboard

Quick Question on Game Stats

Open cmorancie opened this issue 9 years ago • 1 comments

So I am trying to get the play by play breakdown and the best way to do that seems to be this:

game.players.csv('player-stats.csv')

so, I did this:

games = nflgame.games(2013, week=1,home="CHI") game = games[0] games[0].players.csv('player-stats.csv') However, can't seem to generate the file (was able to do: nflgame.combine(nflgame.games(2010)).csv('season2010.csv') just fine)

Two questions:

  1. Can you point me as to what I did wrong
  2. I am really after data like this for a single game

(DEN, DEN 22, Q4, 3 and 8) (4:42) (Shotgun) P.Manning pass short left to D.Thomas for 78 yards, TOUCHDOWN. Penalty on BAL-E.Dumervil, Defensive Offside, declined.

Is this the wrong approach ?

Thanks !!!!

cmorancie avatar Oct 14 '15 22:10 cmorancie

NOTE: This is probably a question better posed to the nflgame repo (you are in the nfldb repo).

Running your code generated a file in my working directory: image

But unless you have a particular need for playing with .csv format, there are easier ways to access the nflgame data you are after, especially if it is just play-by-play descriptions you are after.

import nflgame
games = nflgame.games(2013, week=1, home="CHI")
for game in games:
    print game

plays = nflgame.combine_plays(games)
for play in plays:
    print play
CIN (21) at CHI (24)
(CIN, CIN 35, Q1) M.Nugent kicks 65 yards from CIN 35 to end zone, Touchback.
(CHI, CHI 20, Q1, 1 and 10) (15:00) J.Cutler pass incomplete short middle to M.Bennett [G.Atkins].
(CHI, CHI 20, Q1, 2 and 10) (14:55) (Shotgun) M.Forte left tackle to CHI 28 for 8 yards (L.Hall).
Timeout #1 by CHI at 14:09.
<...>
(CHI, CIN 30, Q4, 2 and 11) (:33) J.Cutler kneels to CIN 31 for -1 yards.
END GAME

ochawkeye avatar Oct 26 '15 04:10 ochawkeye