'Scraping data from basketball reference and it is not looping through full url
The code only loops up to this point in the url 'https://www.basketball-reference.com/teams/{0}' and nothing after, so it is grabbing the incorrect data on an incorrect url
team_abbrev = pd.read_csv(r'C:\Users\micha\OneDrive\Desktop\NBA\team_abbreviations.csv')
for i in team_abbrev:
url = ('https://www.basketball-reference.com/teams/{0}/2022/gamelog-advanced/#tgl_advanced').format(i)
team_perf = pd.read_html(url)[0]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|