probberechts / soccerdata

⛏⚽ Scrape soccer data from Club Elo, ESPN, FBref, FiveThirtyEight, Football-Data.co.uk, FotMob, Sofascore, SoFIFA, Understat and WhoScored.
https://soccerdata.readthedocs.io/en/latest/
Other
573 stars 101 forks source link

[FBref] Seasons parameter does not work with read_player_season_stats method #46

Closed Suwadith closed 2 years ago

Suwadith commented 2 years ago

FBRef read_player_season_stats method does not seems to be considering the seasons parameter. No matter what the season is mentioned inside the brackets it just retrevied the recent season player stats. 2021-2022.

Code used is mentioned below

import soccerdata as sd

fbref = sd.FBref(no_cache=False, no_store=False, leagues="ENG-Premier League", seasons='11-12')
pl_player_season_stats = fbref.read_player_season_stats(stat_type='standard')
pl_player_season_stats .head()

Seasons parameter works perfectly with the read_team_season_stats method though.

Suwadith commented 2 years ago

Thanks for the update. I still don't think this issue has been fixed.

I tried using the new 1.0.1 version, but the issue still prevails. Below in the screenshot you can see that some of these players should not exists in the 15-16 squad. It retrieves the data from the 2021-2022 season which is the most recent season ignoring the seasons parameter.

import soccerdata as sd

fbref = sd.FBref(no_cache=False, no_store=False, leagues="ENG-Premier League", seasons=2015)

player_season_stats = fbref.read_player_season_stats(stat_type="standard")
player_season_stats.head()

image_2022-05-31_014912361

probberechts commented 2 years ago

Did you empty the cache? Try to set no_cache=True or remove the ~/soccerdata/data/FBref directory.

Also make sure you are really running the updated version by running print(sd.__version__).

Suwadith commented 2 years ago

Did you empty the cache? Try to set no_cache=True or remove the ~/soccerdata/data/FBref directory.

Also make sure you are really running the updated version by running print(sd.__version__).

My bad. Thank you so much for pointing it out. It works perfectly :)