How to Scrape NBA Stats API with Python
Вставка
- Опубліковано 16 вер 2024
- Learn how to scrape the NBA Stats API with Python so you can download all of the NBA Data to a local CSV file. We will use Pandas and the Python Requests modules to make this happen. This is a great project for anyone looking to build an NBA Fantasy Basketball model!
Step-by-Step Article: / building-an-nba-mysql-...
GitHub Repo: github.com/Jma...
Greg Reda Blog Post: www.gregreda.co...
This is beautiful!
AHHHHHHHHHHHHHHHHHHHHH THANK YOU THIS WOOOOOORRRRRRRKKKKKKKKSSSSSSSSSSSSSSSSS
I followed this exactly and I keep getting a empty set somehow at the end any help would be appreciated.
Lmfao the intro music 😂😂😂😂
What about lineup starters? One key info some person personally needs
Thanks Jabe, I tried doing this using the curl on a rest.api client to generate the code but could not get the request to work at all. This one did the trick.
Subbed!
great tutorial! my question is how can i download the csv file after doing everything? haha
There's an another way to do this directly in Excel using PowerQuery. Check out this video: ua-cam.com/video/BlJk-RD3rAI/v-deo.html
10:15 I keep getting an error saying 65 columns passed, passed data had 68 columns.
For future people using this: NBA Advanced stats added 3 more columns, check in leagedashplayerstats as shown in 3:00 to see the actual column lists size which updated from 65 to 68 as of this comment date.
I had to add in 3 more columns: 'nickname', 'wnba_fantasy_pts_rank', AND 'leaguedashplayerstats'.
Problem solved.
Seeing that you're the latest to do this even after 2 years, were you able to create what you needed? For some reasone at 8:59 I created a print for "player_info" but nothing came of it. Which makes me think "player_info = response['resultSets'][0]['rowSet']" isn't working or the headers is wrong for me.
@@jaredhutchinson4629 Yes, I was able to make it but I didn't really finish it all the way to the end. Just enough to see that it works.
are you banned now?
Hi Jabe,
Congratulations on the job, I'm trying to develop something that consumes NBA stats.
but I run into a problem, following your steps my dataframe only contains 23 columns instead of 65
could you let me know if there is anything i can do?
again congrats.
Does anyone else get JSONDecodeError: Expecting value: line 1 column 1 (char 0) when running the response command?
I've tried to stack overflow myself out but nothing I did worked. Help please 🙏
having same issue here
@@akhilreddy5892 same
make sure you're requesting from the correct url and using the correct headers described in the video.
that error comes from having a blank json file which means you either requested the wrong url (so you weren't able to get any data so the json was empty) or you got cockblocked by adam silver (because he detected you were running a python script since you didn't use the headers so you weren't able to extract anything)
did u guys ever figure out how to fix it?
There's an another way to do this directly in Excel using PowerQuery. Check out this video: ua-cam.com/video/BlJk-RD3rAI/v-deo.html