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

get_game_logs() = UnboundLocalError: local variable 'df' referenced before assignment #91

Open
GeraGom opened this issue Sep 7, 2022 · 2 comments

Comments

@GeraGom
Copy link

GeraGom commented Sep 7, 2022

PGGstats = get_game_logs('Caris LeVert','2021-10-19','2022-04-11')
print(PGGstats)

runcell(0, 'C:/Users/aleka/Documents/test.py')
You searched for "Caris LeVert"
2 results found.
Traceback (most recent call last):

File ~\Documents\test.py:19 in
PGGstats = get_game_logs('Caris LeVert','2021-10-19','2022-04-11')

File ~\AppData\Roaming\Python\Python39\site-packages\basketball_reference_scraper\players.py:68 in get_game_logs
return df

UnboundLocalError: local variable 'df' referenced before assignment

@GeraGom GeraGom changed the title get_game_logs() = get_game_logs() = UnboundLocalError: local variable 'df' referenced before assignment Sep 7, 2022
@GeraGom
Copy link
Author

GeraGom commented Sep 7, 2022

PGGstats = get_game_logs('Caris LeVert','2021-10-19','2022-04-11')
print(PGGstats)

runcell(0, 'C:/Users/aleka/Documents/test.py')
You searched for "Caris LeVert"
2 results found.
Traceback (most recent call last):

File ~\Documents\test.py:19 in
PGGstats = get_game_logs('Caris LeVert','2021-10-19','2022-04-11')

File ~\AppData\Roaming\Python\Python39\site-packages\basketball_reference_scraper\players.py:68 in get_game_logs
return df

UnboundLocalError: local variable 'df' referenced before assignment

@rolltyed
Copy link

WIthout digging too deep into this, I see that the error is being thrown because a table is not being found in the get_game_logs function when it scrapes the referenced site. The if table: statement needs a correlating else statement for when the expected table is missing. I suspect that the link reference needs updating, possibly because the NBA season is over or maybe a change in how the site processes requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants