Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with 19/20 season, game id 0020200577 #13

Closed
EuanDewar opened this issue Feb 10, 2020 · 8 comments
Closed

Issues with 19/20 season, game id 0020200577 #13

EuanDewar opened this issue Feb 10, 2020 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@EuanDewar
Copy link

The scraper seems to be having issues with this current season. Specifically something to do with the game of id 0020200577.

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    ns.scrape_date_range('2019-10-22', '2020-02-10', data_format='csv')
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\nba_scraper\nba_scraper.py", line 78, in scrape_date_range
    scraped_games.append(sf.main_scrape(game))
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\nba_scraper\scrape_functions.py", line 688, in main_scrape
    game_df = scrape_pbp(v2_dict)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\nba_scraper\scrape_functions.py", line 112, in scrape_pbp
    if pbp_v2_df.game_id.unique()[0] == "0020200577":

Thanks

@mcbarlowe
Copy link
Owner

Can you please post the full stack trace including the Error?

@mcbarlowe mcbarlowe self-assigned this Feb 10, 2020
@EuanDewar
Copy link
Author

EuanDewar commented Feb 10, 2020

Apologies I thought I had. Stupidly missed out a line.

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    ns.scrape_date_range('2019-10-22', '2020-02-10', data_format='csv')
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\nba_scraper\nba_scraper.py", line 78, in scrape_date_range
    scraped_games.append(sf.main_scrape(game))
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\nba_scraper\scrape_functions.py", line 688, in main_scrape
    game_df = scrape_pbp(v2_dict)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\nba_scraper\scrape_functions.py", line 112, in scrape_pbp
    if pbp_v2_df.game_id.unique()[0] == "0020200577":
IndexError: index 0 is out of bounds for axis 0 with size 0

@mcbarlowe
Copy link
Owner

mcbarlowe commented Feb 10, 2020

Does it scrape any games before it errors out? Because it could be trying to scrape the canceled game between the Lakers and the Clippers which returns an empty API call on the play by play. Which would lead to that error

@EuanDewar
Copy link
Author

Yep it does, works fine up until that point. Likely that's the culprit then

@mcbarlowe
Copy link
Owner

Ok that game was on 1/27/2020 so you can scrape up to that date then skip it and continue. You can then manually scrape the game_ids from the games you need. You can get those ids from here https://stats.nba.com/scores/01/27/2020 they'll be in the url for each game play by play. So for the Rockets/Jazz game that day here's the link https://stats.nba.com/game/0021900698/playbyplay/ and then you would pass 21900698 in a list with the other games to the non date range scraper function to get them. Closing this Issue please post if you have further problems

@mcbarlowe mcbarlowe added the wontfix This will not be worked on label Feb 10, 2020
@mcbarlowe mcbarlowe pinned this issue Feb 10, 2020
@EuanDewar
Copy link
Author

EuanDewar commented Feb 11, 2020

Turns out it isn't that game. It's this one, which is from 2003 and yet appears to be getting pulled in?

https://stats.nba.com/game/0020200577/playbyplay/

@mcbarlowe
Copy link
Owner

mcbarlowe commented Feb 18, 2020

Ok I'll take a look at this missed the email with your comment. Reopening. Also are you absolutely sure its that game id because that line of code if pbp_v2_df.game_id.unique()[0] == "0020200577": is just a check that then does stuff if it is that game. What was the last game_id you are able to scrape before the error appeared?

@mcbarlowe mcbarlowe reopened this Feb 18, 2020
@mcbarlowe mcbarlowe added bug Something isn't working and removed wontfix This will not be worked on labels Feb 18, 2020
@mcbarlowe
Copy link
Owner

Haven't been able to replicate this issue, still believe its from trying to scrape the canceled game. Closing.

@mcbarlowe mcbarlowe unpinned this issue Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants