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

La Liga issue in Whoscored #790

Open
Messe57 opened this issue Jan 17, 2025 · 0 comments
Open

La Liga issue in Whoscored #790

Messe57 opened this issue Jan 17, 2025 · 0 comments

Comments

@Messe57
Copy link

Messe57 commented Jan 17, 2025

I use to download data for top 5 leagues, but lately La Liga stop working due to an unknown issue. I tried to define what was, but I couldn't. I use a VPN when I scrape because my local language cause some problems. Thanks in advance for your help.

import soccerdata as sd
seasons = ['2425'] 
leagues = ['ESP-La Liga']  

for season in seasons:
    for league in leagues:
        ws = sd.WhoScored(leagues=league, seasons=season, headless=False) 
        ws._driver.get("https://www.whoscored.com/")
        ws._driver.execute_script("location = 'https://whoscored.com/'")
        schedule = ws.read_schedule()
        matches = ws.read_events(output_fmt='events')

This is the error I get:
KeyError Traceback (most recent call last)
Cell In[17], line 14
12 ws._driver.get("https://www.whoscored.com/")
13 ws._driver.execute_script("location = 'https://whoscored.com/'")
---> 14 schedule = ws.read_schedule()
15 matches = ws.read_events(output_fmt='events')

File c:\Users\filip\AppData\Local\Programs\Python\Python311\Lib\site-packages\soccerdata\whoscored.py:347, in WhoScored.read_schedule(self, force_cache)
334 def read_schedule(self, force_cache: bool = False) -> pd.DataFrame:
335 """Retrieve the game schedule for the selected leagues and seasons.
336
337 Parameters
(...)
345 pd.DataFrame
346 """
--> 347 df_season_stages = self.read_season_stages(force_cache=force_cache)
348 filemask_schedule = "matches/{}{}{}_{}.json"
350 all_schedules = []

File c:\Users\filip\AppData\Local\Programs\Python\Python311\Lib\site-packages\soccerdata\whoscored.py:277, in WhoScored.read_season_stages(self, force_cache)
264 def read_season_stages(self, force_cache: bool = False) -> pd.DataFrame:
265 """Retrieve the season stages for the selected leagues.
266
267 Parameters
...
-> 6249 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
6251 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())
6252 raise KeyError(f"{not_found} not in index")

KeyError: "None of [Index(['ESP-La Liga'], dtype='object', name='league')] are in the [index]

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

1 participant