derek-adair / nflgame

A working snapshot of nflgame (for historic purposes). This project is no longer active.
http://nflgame.derekadair.com
The Unlicense
331 stars 100 forks source link

data appears incomplete for three specific weeks (including 2019 week 16) #99

Closed opi9a closed 4 years ago

opi9a commented 4 years ago

I cannot get data for 2019 week 16 (or for two other weeks in previous years).

>>> import nflgame
>>> len(nflgame.games(year=2019, week=15))
16
>>> len(nflgame.games(year=2019, week=16))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gav/anaconda3/lib/python3.7/site-packages/nflgame/__init__.py", line 224, in games
    return list(games_gen(year, week, home, away, kind, started))
  File "/home/gav/anaconda3/lib/python3.7/site-packages/nflgame/__init__.py", line 271, in gen
    g = nflgame.game.Game(**info)
  File "/home/gav/anaconda3/lib/python3.7/site-packages/nflgame/game.py", line 315, in __new__
    game.data = json.loads(game.rawData.decode('utf-8'))[game.eid]
AttributeError: 'NoneType' object has no attribute 'decode'

I get the same error for year=2017, week=1 and year=2018, week=16. All other weeks from 2009 on are ok.

Thanks.

trojanguard25 commented 4 years ago

While I can't say what is going on with the 2017 and 2018 seasons, there was a comment on another issue regarding the 2019 issue in #98, specifically comment https://github.com/derek-adair/nflgame/issues/98#issuecomment-568932261 Basically, you should try running the nflgame-update-schedule from the /scripts/ folder with --rebuild flag.

opi9a commented 4 years ago

Great that works, thanks.

As an aside, having installed using pip install nflgame-redux==2.0.1b1 I cannot see a scripts/ folder as described.

Instead I ran the following from the nflgame/ home directory:

$ python update_schedule.py --rebuild

Thanks again

Coop197823 commented 4 years ago

I also am still having this same issue. I ran from cmd (@ location Python37\Scripts):

$ python nflgame-update-schedule --rebuild

in my python 37 directory, but the same error still persists as the OP stated.

Any thoughts on what else to try?

opi9a commented 4 years ago

You have tried what I did?

Coop197823 commented 4 years ago

yes, I found the error seemed to be my env variables were pointing to my 27 python and not my 37 python.

However I did notice that players teams did not update correctly. For instance, when I run code:


import nflgame
week = 16
games = nflgame.games(2018, week=week)           
for play in play.filter(passing_incmp__gt=0):
    for player in play.players:
        if player.player is not None and player.player.position in ['WR', 'TE', 'RB']:
            row = [player.name, player.player.team, player.player.position,  play.passing_incmp_air_yds] 
            print(row)

Z.Jones shows up with team OAK (instead of BUF for 2018). So it seems the players have not updated correctly for 2018.

ochawkeye commented 4 years ago

player.player.team is referencing their current team as it is taken from the player's current NFL profile.

http://www.nfl.com/player/zayjones/2557863/profile

You might try player.team instead of player.player.team

On Sun, Jan 5, 2020 at 2:38 PM Coop197823 notifications@github.com wrote:

yes, I found the error seemed to be my env variables were pointing to my 27 python and not my 37 python.

However I did notice that players teams did not update correctly. For instance, when I run code:

import nflgame week = 16 games = nflgame.games(2018, week=week) for play in play.filter(passing_incmp__gt=0): for player in play.players: if player.player is not None and player.player.position in ['WR', 'TE', 'RB']: row = [player.name, player.player.team, player.player.position, play.passing_incmp_air_yds] print(row)

Z.Jones shows up with team OAK (instead of BUF for 2018). So it seems the players have not updated correctly for 2018.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/derek-adair/nflgame/issues/99?email_source=notifications&email_token=AAW3P3ITSCYRAJYV7MM3MO3Q4JAMBA5CNFSM4KA253GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEID67NI#issuecomment-570945461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAW3P3IP7JIDCLQJNMFE22LQ4JAMBANCNFSM4KA253GA .

Coop197823 commented 4 years ago

Is there a way to specifically match older players to teams?

Sent from my iPhone

On Jan 5, 2020, at 4:42 PM, ochawkeye notifications@github.com wrote:

player.player.team is referencing their current team as it is taken from the player's current NFL profile.

On Sun, Jan 5, 2020 at 2:38 PM Coop197823 notifications@github.com wrote:

yes, I found the error seemed to be my env variables were pointing to my 27 python and not my 37 python.

However I did notice that players teams did not update correctly. For instance, when I run code:

import nflgame week = 16 games = nflgame.games(2018, week=week) for play in play.filter(passing_incmp__gt=0): for player in play.players: if player.player is not None and player.player.position in ['WR', 'TE', 'RB']: row = [player.name, player.player.team, player.player.position, play.passing_incmp_air_yds] print(row)

Z.Jones shows up with team OAK (instead of BUF for 2018). So it seems the players have not updated correctly for 2018.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/derek-adair/nflgame/issues/99?email_source=notifications&email_token=AAW3P3ITSCYRAJYV7MM3MO3Q4JAMBA5CNFSM4KA253GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEID67NI#issuecomment-570945461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAW3P3IP7JIDCLQJNMFE22LQ4JAMBANCNFSM4KA253GA .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

ochawkeye commented 4 years ago

You might try player.team instead of player.player.team