Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick Question on Game Stats #111

Open
cmorancie opened this issue Oct 14, 2015 · 1 comment
Open

Quick Question on Game Stats #111

cmorancie opened this issue Oct 14, 2015 · 1 comment

Comments

@cmorancie
Copy link

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 !!!!

@ochawkeye
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants