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

Antonio Brown's stats are wrong #90

Closed
bjkronen opened this issue Jul 23, 2015 · 12 comments
Closed

Antonio Brown's stats are wrong #90

bjkronen opened this issue Jul 23, 2015 · 12 comments

Comments

@bjkronen
Copy link

I wrote a simple python program that creates a weekly and yearly stats representation of every player in the league and computes their fantasy points based off of these stats. I have verified about 50 of the other top 50 point scorers in the league, and all of their stats and point totals matchup with what is on yahoo, espn.com and nfl.com Antonio Brown's stats are wrong for 2013 and 2014 that I have checked so far. For instance in 2014, he had 129 receptions and 1698 yards. nfldb is returning 122 receptions and 1570 yards.

@BurntSushi
Copy link
Owner

Maybe you're missing a game somewhere? Try this: #89

Failing that, please check his stats on NFL.com's GameCenter pages. Sometimes they are wrong or off a little.

@bjkronen
Copy link
Author

The totals I am getting from him are for a season long query so I don't know how I could be missing games. But like I said, I've manually verified about 50 other players against nfl.com, yahoo.com and espn.com and everyone else is in sync with the nfldb query except for him. My code for querying on the season is below. Let me know if I am confused. Thanks.

q = nfldb.Query(db)
q.game(season_year=2014, season_type='Regular')

for pp in q.sort('passing_yds').as_aggregate():
....

@bjkronen
Copy link
Author

I just tried deleting antonio brown from player and play_player tables, which worked. My thinking based on your #89 post that you referenced, was that afterwards running nfldb-update would merge in all his stats, but they are still missing. Do I need to reload the table from scratch or is there another way to correct this issue. Thanks.

@BurntSushi
Copy link
Owner

Uh... Deleting entries from the player and play_player tables was a very bad idea. You now have to reload every game antonio brown ever played in. Either that, or just start from scratch.

I pointed to #89 so that you could try that very specific fix. I mean literally: delete that game and re-run nfldb-update.

It is totally feasible for you to be missing one game or part of one game, even if the top 50 players are exactly correct. For example, they may not have participated in that game.

Finally, as I said before, the data is not perfect. There is nothing you can do about that. The reason why I suggested that a game was missing was because of the stats. Namely, you're missing 7 receptions and 128 yards. That sounds like one game's worth to me.

You need to do some digging to figure out where the stats have gone wrong. e.g., Look at his stats for each individual game.

@bjkronen
Copy link
Author

Thanks. I will reload the database from scratch and figure out what game is missing.

@ochawkeye
Copy link
Contributor

Not sure it helps you much, but his stats check out OK on my PC with both nflgame and nfldb

import nflgame

games = nflgame.games(year=2014, week=[i for i in range(1, 18)], home='PIT', away='PIT')
plays = nflgame.combine_plays(games)

for player in plays.players().receiving():
    if str(player) == 'A.Brown':
        print player.stats



import nfldb
print '-'*79
def season_player_stats(full_name, season):
    db = nfldb.connect()
    q = nfldb.Query(db)

    q.game(season_year=season, season_type='Regular', week= [i for i in range(1, 18)])
    q.player(full_name=full_name)
    pps = q.as_aggregate()

    assert len(pps) < 2, "Make sure only one player was aggregated"
    if len(pps) == 0:  # No players found to aggregate
        return None
    return pps[0]

x = season_player_stats('Antonio Brown', 2014)
print x
P:\Projects\Home Computer\Fantasy Football>python bjkronen.py
OrderedDict([('receiving_yds', 1698), ('receiving_rec', 129), ('receiving_tar', 181), ('receiving_yac_yds', 601), ('punt
ret_yds', 319), ('puntret_tot', 30), ('puntret_fair', 16), ('receiving_tds', 13), ('penalty', 5), ('penalty_yds', 60), (
'rushing_att', 4), ('rushing_yds', 13), ('passing_att', 2), ('passing_yds', 20), ('passing_cmp', 2), ('passing_cmp_air_y
ds', 9), ('passing_tds', 1), ('kickret_yds', 0), ('kickret_ret', 1), ('fumbles_tot', 2), ('fumbles_forced', 1), ('fumble
s_lost', 2), ('defense_tkl', 2), ('fumbles_notforced', 1), ('receiving_twoptm', 1), ('receiving_twopta', 1), ('puntret_t
ds', 1)])
-------------------------------------------------------------------------------
{'fumbles_tot': 2L, 'passing_att': 2L, 'puntret_yds': 319L, 'receiving_tds': 13L, 'receiving_yac_yds': 601L, 'passing_yd
s': 20L, 'defense_tkl': 2L, 'rushing_yds': 13L, 'puntret_tot': 30L, 'passing_cmp_air_yds': 9L, 'fumbles_forced': 1L, 'fu
mbles_lost': 2L, 'fumbles_notforced': 1L, 'receiving_rec': 129L, 'receiving_twopta': 1L, 'receiving_yds': 1698L, 'rushin
g_att': 4L, 'receiving_twoptm': 1L, 'receiving_tar': 181L, 'passing_cmp': 2L, 'puntret_fair': 16L, 'puntret_tds': 1L, 'p
assing_tds': 1L, 'kickret_ret': 1L}

@ochawkeye
Copy link
Contributor

I suspect your problem is with week 17.

import nflgame
for i in range(1, 18):
    game = nflgame.one(2014, i, home='PIT', away='PIT')
    if game:
        for player in game.max_player_stats():
            if str(player) == 'A.Brown':
                print '{:>2} {:<25} {:>2} {:>3}'.format(i, game, player.stats['receiving_rec'], player.stats['receiving_yds'])
 1 CLE (27) at PIT (30)       5 116
 2 PIT (6) at BAL (26)        7  90
 3 PIT (37) at CAR (19)      10  90
 4 TB (27) at PIT (24)        7 131
 5 PIT (17) at JAC (9)        5  84
 6 PIT (10) at CLE (31)       7 118
 7 HOU (23) at PIT (30)       9  90
 8 IND (34) at PIT (51)      10 133
 9 BAL (23) at PIT (43)      11 144
10 PIT (13) at NYJ (20)       8  74
11 PIT (27) at TEN (24)       9  91
13 NO (35) at PIT (32)        8  97
14 PIT (42) at CIN (21)       9 117
15 PIT (27) at ATL (20)      10 123
16 KC (12) at PIT (20)        7  72
17 CIN (17) at PIT (27)       7 128

@bjkronen
Copy link
Author

I removed the nfldb and reloaded it and am still missing the stats. ochawkeye, I tried both your nflgame and nfldb example program. It provided the correct statistics for the nflgame example (my output matched yours), but not for the nfldb example. I'll try removing the game and running nfldb-update.

@bjkronen
Copy link
Author

After simply removing the game burntsushi recommended in the first place and running nfldb-update, the problem has been resolved. Is there a thread outside of #89 that I should refer to for possible missing game data so that I can go through and verify other games that may have missing data? Ochawkeye was your nfldb query correct without having to ever manually remove that game and run nfldb-update?

@bjkronen bjkronen reopened this Jul 23, 2015
@BurntSushi
Copy link
Owner

No. Missing games really shouldn't happen. I just need to update the SQL file that I put up for download.

@ochawkeye
Copy link
Contributor

Ochawkeye was your nfldb query correct without having to ever manually remove that game and run nfldb-update?

Nope, I did not have to manually remove the game that I recall. Though if you experienced this same issue after a re-installation of nfldb it is possible that the game in question is corrupt in the JSON file being included from nflgame. My install pre-dates that game being played and would have been added to my \Lib\site-packages\nflgame\gamecenter-json directory organically via regular nfldb-updates being run on my local machine.

Edit: BAH! I'm getting nfldb and nflgame confused....

@bjkronen
Copy link
Author

All of this makes sense, Thanks again for the help.

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

3 participants