ethanluoyc / statsnba-playbyplay

Parsing play-by-play data from stats.nba.com
MIT License
48 stars 12 forks source link

Can't identify players on floor #2

Closed mpw5421 closed 6 years ago

mpw5421 commented 7 years ago

When running a modified version of the matchup python notebook to loop through all the games in a particular season to generate a separate matchup file for each game, I run into occasional errors. One of them is the UpdatePlayersException ('Could not locate on floor players') when it can't identify all 10 players on the court at the start of a new quarter.

This seems to happen because players only appear in the boxscore generated via the api when they've accumulated at least one stat during the time frame being searched. So if someone new subs in at the start of the quarter and doesn't register any stats from the beginning of the quarter until the first substitution in the new quarter, that player never shows up in the box score and can't be identified as being on the floor.

I was wondering if you have any plans to work around this issue. If I think of anything that could help address the issue I'll make another post.

ethanluoyc commented 7 years ago

Yes, so the problem is with a limitation of the statsnba API. the API does not give you directly the matchup information, so I think what I did is to send multiple requests and workout the matchups from there. However, sometimes, we cannot work out the matchups with those requests, in that case, an UpdatePlayerException is thrown.

You might want to consider simply pass on those exceptions and drop a few matchups if you are ok with that. I don't think this is a frequent problem and most of the time you will have no issues with this.

mpw5421 commented 7 years ago

Yeah, it's not as big of an issue as I thought originally. When I first ran the program for 2016-17 regular season, I was missing around 25 games, but it turns out the majority of those were caused by the rebounding issue, which I fixed with the new Type function. I now usually only am missing around 3-6 games per regular season due to the UpdatePlayerException which isn't a major issue (not that even 20 games was a big deal either). Thanks for the clarification.