nba_api
nba_api copied to clipboard
'https://stats.nba.com/stats/teamyearbyyearstats' endpoint is giving me a (JSONDecodeError: Expecting value: line 1 column 1 (char 0)) error when trying to load the info into a DataFrame
NBA API Version
v1.4.0
Issue
'https://stats.nba.com/stats/teamyearbyyearstats' endpoint is giving me a (JSONDecodeError: Expecting value: line 1 column 1 (char 0)) error when trying to load the info into a DataFrame. I am trying to get the TeamYearByYear stats to build a model.
Code
The issue is that you are using the team abbreviation, not the team ID. Team ID is a 10 digit identifier.
yby_stats = teamyearbyyearstats.TeamYearByYearStats(
team_id = '1610612738' #Boston Celtics
)
print(yby_stats.get_data_frames()[0])
You can find them from the stats library: https://github.com/swar/nba_api/blob/master/src/nba_api/stats/library/data.py