swar / nba_api

An API Client package to access the APIs for NBA.com
MIT License
2.4k stars 520 forks source link

the method "boxscorefourfactorsV2" does not scrape some data well. #258

Open RubenRuVito opened 2 years ago

RubenRuVito commented 2 years ago

Hi!, and first of all thank you for the development and maintenance of this API. By using this method, I have realized that the data is not the same as that of the scraping website. for example for the first game of the 2021-22 season there are some decimal differences.

To prove the evidence I get the data from the first game.. df_4factors = endpoints.boxscorefourfactorsv2.BoxScoreFourFactorsV2(game_id=22100001).get_data_frames()[1]

imagen

and on the NBA website for the same statistics... imagen

it seems that both TOV% and OREB% are losing decimals..

I have not discovered if there is any other way, through your api to recover the advanced statistics of the 4 factors; if it existed, how could I do it?.

Bye, and thanks for the api.

TK05 commented 1 year ago

The table you're comparing it to (second image) is actually using the TeamGameLogs endpoint. This looks to be an inconsistency between the two endpoints and and issue with these endpoints returning different results.

The BoxScoreFourFactorsV2 endpoint is on this page (7.4 TOV%): https://www.nba.com/game/bkn-vs-mil-0022100001/box-score?type=fourfactors

Screen Shot 2022-09-10 at 10 55 13 AM

Screen Shot 2022-09-10 at 10 55 21 AM

The TeamGameLogs endpoint is used on the multi-game table (https://www.nba.com/stats/teams/boxscores-four-factors/?Season=2021-22&SeasonType=Regular%20Season&sort=gdate&dir=-1) and, unfortunately, returns slightly different results for the same game_id (7.8 TOV%):

Screen Shot 2022-09-10 at 11 15 39 AM

Neither of these values match or are even close to the boxscore four factor values on bball-ref (https://www.basketball-reference.com/boxscores/202110190MIL.html) so I could not tell you which endpoint is "more" accurate unfortunately.