nba_api icon indicating copy to clipboard operation
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

Open coryselzer opened this issue 2 years ago • 1 comments

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

Screenshot 2023-11-20 at 6 51 30 PM

coryselzer avatar Nov 21 '23 00:11 coryselzer

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

wild-bill avatar Dec 04 '24 19:12 wild-bill