roclark / sportsipy

A free sports API written for python
MIT License
482 stars 188 forks source link

Incorrect home stats for NBA games #548

Open u-thapa opened 3 years ago

u-thapa commented 3 years ago

Describe the bug I was trying to pull some box score stats for NBA games, and I found that while the away stats are correct, the home stats are way off. For example, the game between the Celtics and Cavaliers gives 47 points for the Celtics, as opposed to the 90 that they actually had, 60 minutes played as opposed to the 240 they actually played, etc etc. This is also true for every other home team in every game I can see, and for all of the other home team basic (not advanced) stats. In the code example below, 90 should be printed, but 47 is printed.

example from sportsreference.nba.boxscore import Boxscore Boxscore('200810280BOS').home_points

Desktop (please complete the following information):

Additional context I believe it is likely that it's just pulling the wrong data from somewhere, would you be able to shed some light on this?

sseljan commented 3 years ago

You can fix this issue for home points by using sportsipy-0.6.0 (see https://github.com/roclark/sportsipy/issues/470, https://github.com/roclark/sportsipy/issues/498, https://github.com/roclark/sportsipy/pull/505).

However, I still see errant home stats for some games. For example:

from sportsipy.nba.boxscore import Boxscore game = Boxscore('202101080DET').dataframe

yields: game['home_field_goals'] 202101080DET 4

It appears that the issue only occurs in games with overtime.

keimperk commented 3 years ago

It still persists in the current 0.6.0 version.

Most likely this is because in nba/constants.npy dict BOXSCORE_ELEMENT_INDEX assigns 7 for stats like home_field_goals, but for overtime games it should be 8/9/10 depending on how many overtimes were given (stats for away are still correct though).

cyoung43 commented 3 years ago

Still following. home_points are pulling the total points for the second half only, while shooting percentages, shots attempted, shots made, rebounds, assists, etc. are completely off.