You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]
The text was updated successfully, but these errors were encountered:
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.
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]
The text was updated successfully, but these errors were encountered: